We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
Jack Norton
6 years agoExplorer | Level 3
Files not being downloaded completely
Hi, I am using the following code and noticed that my file is not always downloaded completely. It even optimised with a loop (found online) but this did not solve the problem, can you please help?
...
Jack Norton
6 years agoExplorer | Level 3
I forgot to mention that it's intermittent and it seems the file is downloaded but, incases of failure, it will be missing an extension. It happens with images 1.5 - 5Mb in size, do you know anything about this?
Greg-DB
Dropbox Community Moderator
6 years agoAre you referring to a file extension on fileResponse.File? That would be under your control, not a matter of the Dropbox API/SDK.
For reference, the Dropbox SDK just returns the file data as a stream from GetContentAsStreamAsync(), not file metadata, such as the file name and extension. If you want the file metadata, you can get it from the response object, which in your case would look like 'response.Response'. You can find an example here.
- Jack Norton6 years agoExplorer | Level 3
No, I meant, for example, that I have an image.jpeg. I am receiving the file without the .jpeg extension so earlier I thought the file was not completely downloaded but I then realised that the file type was missing sometimes.
- Greg-DB6 years ago
Dropbox Community Moderator
The file name and extension, "image" and ".jpeg" in this case, would be included as part of the file name in the metadata returned by Dropbox, e.g., in 'response.Response'. Please refer to my previous comment for an example of accessing that. Of course, Dropbox will only have the file name and extension as supplied to Dropbox when the file was uploaded, so if the uploaded file didn't have an extension to begin with, none will be returned.
For reference, you can see in the documentation for DownloadAsync that it gives you a FileMetadata (in 'response.Response' in your case) on which you can access the Name property.
Also, the definition of fileResponse and fileResponse.File themselves aren't shown in the code you shared, but that's presumably how you're serving the file back to your end-users, and would be under your control. You may need to refer to the documentation for those classes for information on using them.
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!