Forum Discussion

MaxEvan's avatar
MaxEvan
New member | Level 2
8 years ago

Download file through JS SDK

I am currently working with your javascript sdk to retrieve a list of files from my dropbox using filesListFolder and I display the files as links on my page. I also use the filesDownload method to give my users the ability to download the files.

 

When a user clicks on a link, the browser's default download window (the one that asks you where you want to save the file) only appears when the file has finished downloading in the background and I then take the blob returned and manually start the download to the user's filesystem afterwards.

 

My problem is that I would like the default browser's download window to open when the user clicks on the link and not after the download has been completed. Do you think there is a way I could do that?

 

Thanks for your help!

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    I can't think of a way to do this using filesDownload. The filesDownload response block won't fire until the data is ready, so you can't build the URL from the blob until then, which you need to trigger the download.

     

    You could use filesGetTemporaryLink instead though. That will directly return a URL you can pass along to the browser to download from. 

    • MaxEvan's avatar
      MaxEvan
      New member | Level 2

      Thank you very much for the answer, I will try that!

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,948 PostsLatest Activity: 34 minutes ago
351 Following

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 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!