You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
fangzefunny
3 years agoExplorer | Level 3
dropbox.filesUpload sometimes does not work
Hi,
I am now doing an online experiment via URL and trying to collect data using dropbox javascript SDK.
At the end of the experiment, the success message was always prompted. But the data wa...
- 3 years ago
fangzefunny wrote:...
At the end of the experiment, the success message was always prompted. But the data was not always uploaded to my dropbox.
...
... var saveDropbox = function(content, filename){ dbx.filesUpload({ path: "/" + filename, contents: content }) }; ...
...
Hi fangzefunny,
In your 'saveDropbox' function, what are you doing with Dropbox 'filesUpload' method result? On success there should be received a file metadata to the file just uploaded and on error - the corresponding error information. As far as I can see, you are ignoring this information. In this context, you function always succeeds regardless if actual upload succeeds or fails. The information of the error pointing the reason of an upload fail is lost too. That's why you never get any error message and your 'success message' always appears. 😉 Be more careful.
Hope this gives direction.
Здравко
3 years agoLegendary | Level 20
fangzefunny wrote:...
At the end of the experiment, the success message was always prompted. But the data was not always uploaded to my dropbox.
...
... var saveDropbox = function(content, filename){ dbx.filesUpload({ path: "/" + filename, contents: content }) }; ......
Hi fangzefunny,
In your 'saveDropbox' function, what are you doing with Dropbox 'filesUpload' method result? On success there should be received a file metadata to the file just uploaded and on error - the corresponding error information. As far as I can see, you are ignoring this information. In this context, you function always succeeds regardless if actual upload succeeds or fails. The information of the error pointing the reason of an upload fail is lost too. That's why you never get any error message and your 'success message' always appears. 😉 Be more careful.
Hope this gives direction.
- Greg-DB3 years agoDropbox Staff
fangzefunny Здравко is correct; you should check the response or error for the call, which you are currently ignoring. You can find an example of handling the response and error for an upload call with the Dropbox API v2 JavaScript SDK here.
- fangzefunny3 years agoExplorer | Level 3
Thanks! I found the reason today.
Sometimes, people make too many mistakes, making the (adaptive) experiment too long, and that causes the data file being too large. The large file cannot pass through the "post" operation, causing the problem of 413.
I was not able to see the error message before. I run it online, so I cannot see others' error messages. When I did it locally, I responded well, so the issue did not occur.Anyway, thanks! It is not a problem with Dropbox!
- Здравко3 years agoLegendary | Level 20
fangzefunny wrote:... The large file cannot pass through the "post" operation, causing the problem of 413. ...
Hi fangzefunny,
For large files consider using upload sessions instead, not single upload. Every upload transaction is guaranteed to pass for no more than 150MB. In a session you can split the file content on pieces 150MB each, at most. In such a way you can upload significantly larger file. 😉
Good luck.
- fangzefunny3 years agoExplorer | Level 3
Got it! Thanks for great suggestions!
About Discuss Dropbox Developer & API
Make connections with other developers
797 PostsLatest Activity: 6 days agoIf 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!