Skip to main content

When I upload a large file (16GB) using the Box API, I often receive no response from the Box server for more than two hours ,How can I resolve this issue?


  • New Participant
  • 1 reply

When I upload a large file (16GB) using the Box API, I often receive no response from the Box server for more than two hours ,How can I resolve this issue?

THE AUTH IS JWT

THANKS

3 replies

rbarbosa Box
  • Developer Advocate
  • 553 replies
  • May 21, 2024

Hi @hugh , welcome to the forum!


For large files, larger than 50 MB, the recommendation is to use the chunked uploads.


I’ve also wrote an article detailing all the upload options for Box.




Not sure if you are using the REST API directly or one of the SDKs, the above examples are in Python.


Let us know if this helps.


  • Author
  • New Participant
  • 1 reply
  • May 22, 2024

@rbarbosa Thank you very much, the information you provided has been of great help to me. I read through the box-python-sdkand found that when using chunked upload, I can choose to upload in the form of a file stream. Does this increase my upload speed? I need to upload a game package, specifically a 16GB zip file.


test_file_path = '/path/to/large_file.mp4'

with open(test_file_path, 'rb') as content_stream:

  total_size = os.stat(test_file_path).st_size

  upload_session = client.folder('0').create_upload_session(file_size=total_size, 

  file_name='large_file.mp4')

  chunked_uploader = 

  upload_session.get_chunked_uploader_for_stream(content_stream=content_stream, file_size=total_size)

  uploaded_file = chunked_uploader.start()

  print(f'File "{uploaded_file.name}" uploaded to Box with file ID {uploaded_file.id}')


rbarbosa Box
  • Developer Advocate
  • 553 replies
  • May 22, 2024

Hi @hugh



Probably not, if I remember correctly the SDK always uses a stream upload in the end.


You can try to take advantage of multi threading, although Python is not ideal because of the Global Interpreter Lock. By default the chunked uploader uses 5 threads, but you can adjust to your situation.


Let us know if this helps


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings