Performs a check to verify that a file will be accepted by Box before you upload the entire file.
File.mp4
The name for the file
The parent folder to upload the file to
123
The ID of parent item
1024
The size of the file in bytes
If the check passed, the response will include a session URL that can be used to upload the file to.
If the check did not pass, the response will include some details on why it did not pass.
An unexpected client error.
curl -X OPTIONS https://api.box.com/2.0/files/content \
-H 'Authorization: Bearer <ACCESS_TOKEN>'
-H "Content-Type: multipart/form-data" \
-F attributes='{"name":"Photo.jpg", "parent":{"id":"11446498"}}'
String fileName = "My Doc.pdf";
BoxFolder rootFolder = BoxFolder.getRootFolder(api);
try {
folder.canUpload(fileName, 98734576);
// If the file upload would not have succeeded, it will not be attempted
folder.uploadFile(fileContents, fileName);
} catch (BoxAPIException ex) (
)
// Verify that uploading a 200MB file named "Preso.ppt" to folder 12345 would succeed
client.files.preflightUploadFile(
'12345',
{
name: 'Preso.ppt',
size: 200000000
},
null,
callback
);