We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff
    It looks like there are a few parts to your code on StackOverflow, so it would be good to isolate where the issue is exactly. I.e., where does the data go from being the expected value to something else?

    There's an example of uploading using the JavaScript SDK here, where the file object is passed in directly to the 'contents' parameter of the filesUpload method:

    https://github.com/dropbox/dropbox-sdk-js/blob/master/examples/javascript/upload/index.html#L54

    That example works fine for me. Are you able to run it successfully?

    For your code, what environment are you using, and what is `req.body.file` exactly? Where is the data that you want to upload coming from originally?

    In order to validate the uploaded file, you can `console.log(response)` to see the metadata for the uploaded file, e.g., to see the file size. I also recommend checking the uploaded file on the Dropbox web site, in order to see if it worked as expected before adding other potential points of failure.
    • jdwileymon's avatar
      jdwileymon
      Explorer | Level 3

      I took the example code from that and plugged it in to my use case. Meaning, instead of recording audio to send as the file I uploaded from the file input, but it gave me the same error. 

       

      To your point of the data expected vs something else, I'm confused as to what that data should be. To the examples, I assumed I could take the data (i.e. the recorded audio in Blob form) and pass it as a file. I've also tried converting the Blob to File: var fileBlob = new File([myblob], "filename"); as I saw this example passing the file object directly, but it's still not openable or useable after upload.

       

      The environment is node.js server and everything else (audio recording) in browser. `console.log(response)` shows [Object] for when I send the data converted to File, or as the other types I specified in my attempts (string, encoded string, etc).

       

      Checking the file in Dropbox via the site is the problem I'm referring to, it gives an "an audio error occurred" there, and when synced loads as "corrupted". Let me know if I can provide more info.

      • jdwileymon's avatar
        jdwileymon
        Explorer | Level 3
        To your question of "req.body.file" - that's the data I'm passing, either File object, blob, etc.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,877 PostsLatest Activity: 9 hours ago
325 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!