Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Rephoto
3 years agoHelpful | Level 5
Error while copying content to a stream in C#
Hi, I encountered the problem "Error while copying content to a stream" when executing the above code. Is there any way to fix it? try { var chunkSize = 16 * 1024 * 1024; ...
- 3 years ago
Rephoto If you wish to optimize your upload process, please refer to the Performance Guide: https://developers.dropbox.com/dbx-performance-guide
That offers some ways you may be able to improve your effective overall upload speed. For example, there are batching and parallelization features you can use.
For instance, as Здравко noted, the default upload session type is "sequential", but you can use "concurrent" to upload file pieces in parallel. That would require you to make some more changes to your code to properly send those pieces in parallel though.
Rephoto
3 years agoHelpful | Level 5
I have tried this before. But they all got this error 😅
Здравко
3 years agoLegendary | Level 20
You should debug yourself connection breaks, but there are other... let say strange things in your code. You're starting upload file content at expected file end instead of the beginning. Why? By the way this is error since the file content cannot have "gaps". Even without connection break, you would receive error denoting inconsistent files.
- Здравко3 years agoLegendary | Level 20
Do you understand that on that place has to be the offset in the file in Dropbox session where ongoing upload would go to? In this context, what would be between offset 0 up to memStream.Length? 🤔 According your code, there is nothing. 😜
Read the documentation with a bit more care!
- Rephoto3 years agoHelpful | Level 5
Yes 😅,
I have done uploading small sized files. And I continue to upload files larger than 150MB in size. But when I use "var result = await _client.Files.UploadSessionStartAsync(body: memStream, sessionType: UploadSessionType.Concurrent.Instance);" I encountered this error ""Error while copying content to a stream."" - Здравко3 years agoLegendary | Level 20
Rephoto wrote:...
I have done uploading small sized files. And I continue to upload files larger than 150MB in size. ...The only difference when you upload larger files, compared to small files, is that you will need to slice file to pieces and upload every piece to its corresponding place in the file session (not on just some place - as you have tried already for small files). If you will left gap in file... it's error (again), doesn't matter file size!
One more thing you should keep in mind when select files pieces size when concurrent upload is selected - every piece must be uploaded to place which offset is an exact power of 2!!! Violating this rule is error! In general the pieces can be different sized while following previous rule, but an easy way to cover the requirement is to select the same size for all pieces (possibly except the last piece - its size is whatever has been left); a size that is exact power of 2 and not less than 4MB (4*1024*1024).
When some error brings up, post the exact code and point out the exact position.
I will avoid giving language/platform related advises - you should be able debug such errors alone. It's not something Dropbox API related.
- Greg-DB3 years ago
Dropbox Community Moderator
Rephoto It's not entirely clear what that latest issue is, but as Здравко said, it doesn't appear to be from the Dropbox API itself; you'll need to debug this more in your code. Also, it looks like the error message is cut off in your screenshot, so make sure you're reading the whole error message when doing so.
About Discuss Dropbox Developer & API
Make connections with 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!