Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
Priya M.
9 years agoExplorer | Level 4
Dropbox API to create a file, write in it via stream and then close the file.
Hi,
I am from Softaculous Ltd. I already have an open issue but here I'm opening a new one which is regarding a different issue.
I have a query regarding Dropbox. We want our users to upl...
Greg-DB
Dropbox Community Moderator
9 years agoNo, you don't need to also call /upload if you're using upload sessions. You specify the path where you want to upload the file when you call /2/files/upload_session/finish.
If you want to upload 1 MB at a time, you would just supply 1 MB of data to each request to /2/files/upload_session/start, /2/files/upload_session/append_v2, and /2/files/upload_session/finish. That is, you would have your app only submit 1 MB of data (in the request body) per call.
When calling /2/files/upload_session/append_v2 or /2/files/upload_session/finish, the 'offset' is the total amount of data that has been uploaded so far for that upload session, in bytes. This is something the app should keep track of client-side, as the app decides how much to upload each time.
There's a basic example of using upload sessions that may be helpful here. It's for the Python SDK, but the logic is the same.
Priya M.
9 years agoExplorer | Level 4
Hi,
Also I'm trying to upload a .tar.gz file but the file is uploaded incompletely and corrupted using upload session functionality. Can you tell me the reason?
Also I'm trying to upload a .tar.gz file but the file is uploaded incompletely and corrupted using upload session functionality. Can you tell me the reason?
- Greg-DB9 years ago
Dropbox Community Moderator
1. I'm not sure I follow. Exactly what functions are called and when is controlled by your app. You may want to step through with a debugger to see what it is doing and how to correct it.
2. You don't have to upload the same amount of data with each call. For example, when you only have less than 1 MB left to upload, you can call finish and upload that less than 1 MB amount of data.
When using upload sessions, you should only call start once per file. Then you can call append as many times as necessary. You should then call finish once. You don't have to send the same amount of data in each call (e.g., the last call will usually contain less than the others) but you do need to upload the file data in order.
If you're not getting valid files, you should debug your implementation to make sure you're sending up all of the correct data, and in order. (From your earlier post, it sounds like you're missing the last piece.)
- Priya M.9 years agoExplorer | Level 4
Hi,
Thank you for your response. I was able to find the reason for the behavior I had been thinking as unexpected.
But while debugging I'm facing issue with curl call. Many timess the curl call fails with the error "Curl Error Start: Empty reply from server (Server returned nothing no headers no data)". Sometimes upload session start returns this error and sometimes append. I'm not able to understand why this is happening.
Can you please tell me why?
- Priya M.9 years agoExplorer | Level 4
Hi,
And sometimes it return this:
Failed sending data to the peer
- Greg-DB9 years ago
Dropbox Community Moderator
Both of these errors are unexpected. Can you share the steps/code to reproduce them?
They may be network issues though, which likely won't reproduce for me though. If that's the case, you'll want to check on any issues with your network connection, and add automatic retrying to your app.
About Dropbox API Support & Feedback
Find help with the Dropbox API from 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!