We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.
Forum Discussion
hsyn
9 years agoNew member | Level 2
python upload big file example
Can you please share an example code of how to upload big files (size > 150 mb) with python api v2 sdk?
Greg-DB
9 years agoDropbox Staff
We don't currently have an official sample app for that, but I'll be sure to pass this along as request for one.
Here's a quick example I put together though: (note, I haven't tested this extensively, and it doesn't have any error handling)
f = open(file_path) file_size = os.path.getsize(file_path) CHUNK_SIZE = 4 * 1024 * 1024 if file_size <= CHUNK_SIZE: print dbx.files_upload(f, dest_path) else: upload_session_start_result = dbx.files_upload_session_start(f.read(CHUNK_SIZE)) cursor = dropbox.files.UploadSessionCursor(session_id=upload_session_start_result.session_id, offset=f.tell()) commit = dropbox.files.CommitInfo(path=dest_path) while f.tell() < file_size: if ((file_size - f.tell()) <= CHUNK_SIZE): print dbx.files_upload_session_finish(f.read(CHUNK_SIZE), cursor, commit) else: dbx.files_upload_session_append(f.read(CHUNK_SIZE), cursor.session_id, cursor.offset) cursor.offset = f.tell()
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!