Chunked Upload with SDKs

Chunked Upload with SDKs

The Box SDKs make it possible to perform a chunked upload with the built-in SDK methods.

Java
File myFile = new File("My Large_File.txt"); 
FileInputStream stream = new FileInputStream(myFile);

BoxFolder rootFolder = BoxFolder.getRootFolder(api);
BoxFile.Info fileInfo = rootFolder.uploadLargeFile(inputStream, "My_Large_File.txt", myFile.length());
Python
chunked_uploader = client.file('12345').get_chunked_uploader('/path/to/file')
uploaded_file = chunked_uploader.start()
print('File "{0}" uploaded to Box with file ID {1}'.format(uploaded_file.name, uploaded_file.id))

The SDKs also support uploading new versions of files through similar methods.

Java
File myFile = new File("My Large_File.txt"); 
FileInputStream stream = new FileInputStream(myFile);

String fileID = "12345";
BoxFile file = new BoxFile(api, fileID);
BoxFile.Info fileInfo = file.uploadLargeFile(inputStream, myFile.length());