We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
Priya M.
8 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...
Priya M.
Explorer | Level 4
Hi,
Thank you for your response.
But this would require uploading the file in one go whereas I want to upload a file in chunks, say, the file size is 500 MB but I want to upload it 100 MB at a time and next continue writing the next 100 MB from the place it left and so on. At the end we want to close the file
Thank you for your response.
But this would require uploading the file in one go whereas I want to upload a file in chunks, say, the file size is 500 MB but I want to upload it 100 MB at a time and next continue writing the next 100 MB from the place it left and so on. At the end we want to close the file
Greg-DB
8 years agoDropbox Staff
For large files, or any files you want to upload in pieces, you should use upload sessions:
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append_v2
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append_v2
https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish
- Priya M.8 years agoExplorer | Level 4
Hi,
Thank you for your response.
I'll implement these and get back to you if I face any issues.
- Priya M.8 years agoExplorer | Level 4
Hi,
I have some doubt about 'files_upload_session_start' API. Do I require to first call the 'upload' API and then start the 'upload_session_start' API as I can't see where to mention the dropbox path where I want to upload the file to in 'upload_session_start' API. Can you please tell me how to implement this?
Also if I want to upload 1MB at a time instead of 150 MB, how can I mention that?
- Greg-DB8 years agoDropbox Staff
No, 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.8 years agoExplorer | Level 4Hi,
I have been trying the same thing but while upload_finish, I was getting the following error:
{"error_summary": "lookup_failed/not_found/..", "error": {".tag": "lookup_failed", "lookup_failed": {".tag": "not_found"}}}
On further research I found out that the error occur due to incorrect session id. I corrected the same and the error was eliminated.
I now have another doubt. I have created three different functions for session start, session append and session finish. From inside session start, if the session id is not empty, session append function is called. Now when initially I'm calling the session start function with 1MB of data to upload, the upload session start executes. Now the session id is filled. So now again the session start function is called (automatically) and session append is done from inside it (as coded by me as session id is now filled.). Now once the session append is done, the same process repeats again and again till 7MB (since the file size I'm trying to upload is 7.48MB). But after 7MB, automatically the session finish funstion is called and the session ends with incomplete file upload.
I have two doubts here:
1. How the looping is going automatically when I'm not putting the code in any loop? Is this the intended behavior?
2. How shall it be handled when there is an extra .48MB of data remaining to upload?
- Priya M.8 years agoExplorer | Level 4
Hi,
While using 'appen_v2' API, there is a parameter 'offset' which is the amount of data that has been uploaded so far. From where do we get the amount of data uploaded so far? Do we have to calculate on our own? As I can't see any amount of data uploaded returned by the 'file_upload_session_start' parameter.
- Priya M.8 years agoExplorer | Level 4
Hi,
Can I get a faster response on this?
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,877 PostsLatest Activity: 12 months 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!