Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi Dears,
am using asp.net core/c# i want upload folder but its not working
using (var stream = new MemoryStream(File.ReadAllBytes(@"E:\a.txt")))
{
var response = client.Files.UploadAsync("/test/" + "a.txt", WriteMode.Overwrite.Instance, body: stream);
}
please can anyone helop me
You are missing the "await"
Kardo ha escrito:Hi Dears,
am using asp.net core/c# i want upload folder but its not working
using (var stream = new MemoryStream(File.ReadAllBytes(@"E:\a.txt")))
{
var response = await client.Files.UploadAsync("/test/" + "a.txt", WriteMode.Overwrite.Instance, body: stream);
}
please can anyone helop me
just before client.XXXX
I've used similar code and it works for small size files, however it does not work for big size files (over 30MB) I got the following exception System.Threading.Tasks.TaskCanceledException still do not know why.
@Octavio1 How long does that call take before failing with TaskCanceledException? I believe TaskCanceledException should indicate a timeout on the network connection for the API call.
It takes around 100 seconds to throw the exception, Im thinking in implementing a "session" to upload the file trough several small requests besause in the future I might need to upload larger files.
Still do not know how to implement it.
Thanks for the response, hope this can help anyone with the same issue.
You are right Gregg, after some investigation I found the following link for another thread for similar issues.
I used it with 1024KB chunks and it is woking properly.
https://www.dropboxforum.com/t5/API-support/Issues-about-Chunkupload/m-p/214661#M11002
I'll give it a try to the sample you sent and provide my experience to the comunity.
Thanks!
By the way, while it sounds like 30 MB is too big for your case, you may want to try something bigger than 1 MB, as a bigger chunk size will generally yield better performance overall. A good size to try would be 8 MB.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!