We’re aware of an issue causing slower load times on the Dropbox Community forum. It should be resolved soon. Thanks for your patience! 

Forum Discussion

amei's avatar
amei
Explorer | Level 3
3 months ago

Using javascript to download file from dropbox

I am creating a javascript routine that requires me to download and upload updated files in my dropbox app file folders which contains updated football picks. I am able to upload files to my app but when I try to upload I get an undefined error. 

file path :

download functions (I tried both of these) :

Both of these functions return the same error :

Any assistance would be greatly appreciated. Thanks. 

14 Replies

  • DB-Des's avatar
    DB-Des
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 months ago

    Hi amei​ 

    The response from 'filesDownload()' does not contain a 'fileBlob' property (which is why you are getting an 'undefined' in the error message). The response contains a 'fileBinary', which can be accessed as such: 'response.result.fileBinary'. Additionally, you can convert the returned Buffer to text or a string by invoking the 'toString()' method on the response. We would also recommend making that callback function an async function:

    ...
    dbx.filesDownload({ path: dropbox_users_path_file })
    .then(async (response) => {
      console.log(response.result.fileBinary.toString())
    }
    ...

    Similarly for the second function:

    ...
    try {
      const response = await dbx.filesDownload({
        path: dropbox_users_path_file
      })
      console.log(response.result.fileBinary.toString())
    }
    ...

    In order to further assist with the file upload error, please provide the code snippet used to upload files to Dropbox. The screenshots provided are both for downloading files ('filesDownload()').

  • amei's avatar
    amei
    Explorer | Level 3
    3 months ago

    LoadFileFromDropbox error (other load function attempt)

     

About Discuss Dropbox Developer & API

Node avatar for 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!