<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to upload files in batch? in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/435409#M22981</link>
    <description>&lt;P&gt;It is very sad that such a big cloud storage does not have reliable uploading function in their SDK.&lt;/P&gt;</description>
    <pubDate>Tue, 07 Jul 2020 12:25:29 GMT</pubDate>
    <dc:creator>feni</dc:creator>
    <dc:date>2020-07-07T12:25:29Z</dc:date>
    <item>
      <title>How to upload files in batch?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/434689#M22971</link>
      <description>&lt;P&gt;Suppose I have some files I'd like to upload to a folder on Dropbox using dropbox-sdk-python. Some of the files are more than 150 MB, some of them less than 1 MB.&lt;/P&gt;&lt;P&gt;The documentation recommends uploading many files in parallel and offers 6 functions for that:&lt;BR /&gt;```&lt;BR /&gt;'files_upload_session_append',&lt;BR /&gt;'files_upload_session_append_v2',&lt;BR /&gt;'files_upload_session_finish',&lt;BR /&gt;'files_upload_session_finish_batch',&lt;BR /&gt;'files_upload_session_finish_batch_check',&lt;BR /&gt;'files_upload_session_start'&lt;BR /&gt;```&lt;BR /&gt;There are a lot of recomendations in their documentation but I did not find a complete example for doing such a common thing. I did not use Dropbox API before and I dont know in which way I should organize all the upload functions. Can anybody share a complete example for batch uploading?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Jul 2020 16:29:47 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/434689#M22971</guid>
      <dc:creator>feni</dc:creator>
      <dc:date>2020-07-04T16:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload files in batch?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/435181#M22976</link>
      <description>&lt;P&gt;We don't currently have an official sample for that using the Python SDK in particular,&amp;nbsp;but I'll pass this along as request for one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's an example I put together for uploading a large files using upload sessions though: (note, I haven't tested this extensively, and it doesn't have any error handling)&lt;/P&gt;
&lt;PRE&gt;f = open(file_path)
file_size = os.path.getsize(file_path)

CHUNK_SIZE = 4 * 1024 * 1024

if file_size &amp;lt;= CHUNK_SIZE:

    print dbx.files_upload(f.read(), 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() &amp;lt;= file_size:
        if ((file_size - f.tell()) &amp;lt;= CHUNK_SIZE):
            print dbx.files_upload_session_finish(f.read(CHUNK_SIZE),
                                            cursor,
                                            commit)
            break
        else:
            dbx.files_upload_session_append_v2(f.read(CHUNK_SIZE),
                                            cursor)
            cursor.offset = f.tell()

f.close()&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jul 2020 17:11:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/435181#M22976</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2020-07-06T17:11:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to upload files in batch?</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/435409#M22981</link>
      <description>&lt;P&gt;It is very sad that such a big cloud storage does not have reliable uploading function in their SDK.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jul 2020 12:25:29 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/How-to-upload-files-in-batch/m-p/435409#M22981</guid>
      <dc:creator>feni</dc:creator>
      <dc:date>2020-07-07T12:25:29Z</dc:date>
    </item>
  </channel>
</rss>

