Multipart upload binary content with OneDrive Rest APIs

倖福魔咒の 提交于 2019-12-13 03:47:59

问题


As per the API documentation here I formed my request with postman as follows: . This is working fine.

But when it comes to binary content(encoded in base64 format), it uploads the file but that is not previewed when I try to open the same on OneDrive. File gets uploaded successfully but not previewable.

What am I missing here? Any suggestions?


回答1:


OneDrive doesn't support Content-Transfer-Encoding when using the multi-part upload method. In this case, we're ignoring the header (that seems like a bug) and just storing the base64 encoded data in the file stream (without decoding it).

You'll have to upload the raw bytes as the second part of the request, without any content-transfer-encoding, to have this work.

Since it seems like you are just uploading a file and not trying to set any custom metadata while doing it, you're better off using one of the other upload methods, like PUT or createUploadSession




回答2:


Drive does not store the image in the base64 format it stores it in binary. you can directly select the image using postman and can upload as binary with the multipart request

Here is the link for adding blob in the postman

How to upload images using postman to azure blob storage



来源:https://stackoverflow.com/questions/47902003/multipart-upload-binary-content-with-onedrive-rest-apis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!