0

As per the API documentation here I formed my request with postman as follows: with the headers part as shown and the body being simple plain text. 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. Uploading image as multipart data encoded in base 64 format File gets uploaded successfully but not previewable.

What am I missing here? Any suggestions?

chetan choulwar
  • 305
  • 1
  • 14

2 Answers2

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

Ryan Gregg
  • 2,015
  • 13
  • 16
  • Thanks for you answer, is there any workaround to send metadata and contents within a single call? Or may be you can help with the content-encoding scheme that is supported by OneDrive. – chetan choulwar Dec 21 '17 at 06:45
  • Could you please have a look at this post https://stackoverflow.com/questions/50905921/how-to-get-the-list-of-possible-operations-that-can-be-performed-on-driveitem-re/51079098#51079098 – chetan choulwar Jun 28 '18 at 10:20
0

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