cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I tell if a file is completely downloaded?

How can I tell if a file is completely downloaded?

Ruby R.
New member | Level 2

I have a client that I'm in the beginning stages of writing an app for. I'm going to be using DropBox to distribute video files to remote servers that will automatically play all of the video files in the media folder back. I don't need to upload files or do any sort of authentication. What I do need, however, is to know that a file is completely downloaded before attempting to play it. When a file is downloaded into the dropbox folder, is it stored in a temporary file that is copied to the final destination after the transfer is entirely complete or is it possible that a file in the dropbox folder is only partially downloaded?

If the latter is the case, what is the best way to determine when the download is complete? Is there a method in the API to determine when a file transfer is complete on a specific client or is it best to check for a file write lock before attempting to play a file?

Thanks in advance for any response!

4 Replies 4

Greg-DB
Dropbox Staff

Is the file on the receiving end being downloaded by the official Dropbox desktop client, or a custom client using the API?

The desktop client will only place files into the actual location in the Dropbox folder once the whole file is available, so you don't need to worry about that.

If you're using the API, this will depend on what SDK/library, if any, you're using. If so, can you elaborate on what you're using and what code you have?

Ruby R.
New member | Level 2

Greg, thanks for the quick response.

Yes, it will be downloaded by the official Windows desktop client. I'm still in the research phase at the moment so I have no code to speak of ye. I actually haven't even decided on the language yet, but I'm leaning toward C#. It looks like I can do what I need by simply looping through the files in the DropBox folder and skipping a file if it throws an access error on the off chance that I try to play it exactly at the time that it is written.

Thanks again for the quick reply.

Nesanel S.
New member | Level 1

Hello, I had a problem which the above question partially addresses ('partially', perhaps pun-intended!). I downloaded some MP3 files, and found that only one of them downloaded fully, but two of them were only partial (part of the file). The problem is that they all play fine - just two get cut off at some point (they just stop playing) - and the time of the file audio length shows in Windows just the  amount that actually got downloaded (so everything looks normal). My question is that I have never heard of such a thing; in Windows, if a file copies over, it is either the whole file, or, if you click 'cancel' (or the power goes out etc.), then you have nothing; there is no such thing as copying over part of a file. If you wanted only part of an MP3 file, you would have to have an audio editor to cut it, and I didn't use anything like that for these files; I simply used them straight out of the box (the Dropbox, that is!). Also, they were files for making CDs. Now they've made about 200 copies and only realized what was going at this point. Because, although we had heard that it got cut of in middle, they figured that that was what had been sent, and just wasn't so perfect on the producers part. Now we realized this, but it hadn't entered my mind for a second to check if the whole file had downloaded because I have never heard of such a thing. (You can, of course, pause a download, and then it will be a 'partial download'. However, you will not be able to use the file until you have the whole thing). TY

Greg-DB
Dropbox Staff

Hi Nesanel, this thread is in the API Development forum, talking about the Dropbox developer platform. It sounds like your specific issue may be better suited in the Issues & Troubleshooting, or by contacting support.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    Nesanel S. New member | Level 1
  • User avatar
    Ruby R. New member | Level 2
What do Dropbox user levels mean?