Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Kardo
9 years agoNew member | Level 2
API v2 c# upload file
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("/t...
Octavio1
8 years agoExplorer | Level 3
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.
Greg-DB
Dropbox Community Moderator
8 years agoOctavio1 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.
- Octavio18 years agoExplorer | Level 3
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.
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! It does sound like the connection is timing out then. You should generally be able to upload 30 MB in a single call, but this will depend on various factors, such as your network connection.
Using upload sessions instead is the best solution. There's an example of using it here:
https://github.com/dropbox/dropbox-sdk-dotnet/blob/9803a40b3169acf66a2d14e29af8750ebe6e3e17/dropbox-sdk-dotnet/Examples/SimpleTest/Program.cs#L333- Octavio18 years agoExplorer | Level 3
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. :slight_smile:
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! :nerd:
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!