Please allow me to explain what I am doing and How I am doing.
What I am doing?
I am trying to upload a file to Onedrive using its REST API Source: one drive api documentation
I am using OneDrive fragments approch to do so as the file can be as huge as 5gb or as small as 1kb (Depends on the user)
Currently, I am doing it using POST-MAN Chrome extention to call APIes
How am I doing?
Selected file that I want to upload (File Size: 729676295 bytes)
Added headers and sent the request and sent the request Here is the result
it is saying that the maximum fragment size is 67108864 bytes so I changed the value of
content-length : 67108864 and content-range : bytes 0-67108863/729676295
but then I get this error message: Declared fragment length does not match the provided number of bytes
Please help me to figure out what should I pass in content-length and content-range.
Many Thanks for you attention.
Finally, thanks to god after 2 days of struggle I found what was the problem.
There are some points that you need to keep in mind
Note: The Next set of bytes should be as long as the previous was. Do not worry because the last fragment can be different.
P.S: Do not use the content-range that you will receive after successfully uploading the fragment.
{totalNumberOfBytesOfFile}
is not same as content-length
;
Content-Length
is bytes of current fragment.
the image is an a example for upload a 4917 bytes file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With