Forum Discussion
source_code
Apr 06, 2021Copper Contributor
Is it possible to upload a file to One Drive if I don't know its size ahead of time?
Our application will frequently have the need to upload a stream of bytes for a file to One Drive, and we won't know the size of the file ahead of time. I am aware of the documentation for One Drive here that clearly indicates it is not possible, but I am really hoping if there's a way to work around this.
Important: Your app must ensure the total file size specified in the Content-Range header is the same for all requests. If a byte range declares a different file size, the request will fail.
Or is there any work being done to enhance the REST API so we can do this? Google Drive uses a very similar method for uploading large files, but supports unknown file sizes by doing this with the Content-Range header during chunk transfer 0-127/* and then on the final chunk we can specify the known size 128-255/256.
I'm just really surprised this is not supported.
- dcbrilhoCopper ContributorI agree with you... I am also surprised that this is not supported.
It is also supported in the Dropbox API.
Did you find any workaround?