How to upload images using postman to azure blob storage

一世执手 提交于 2019-12-03 22:30:42

If we want to upload an image to the azure storage, please have a try to use the Put blob API not Put block API.

And have a try to use the following strToSign.

"PUT\n\n\n{Content-Length}\n\n{Content-Type}\n\n\n\n\n\n\nx-ms-blob-type:BlockBlob\nx-ms-date:{date}\nx-ms-version:2015-12-11\n/accountname/container/blobname"   

I test it on my side, it works correctly on site.

Headers :

Body:

Note: we could get the Content-Length from the file size.

Not really an answer to your question, but I see a number of issues that could cause this problem you're facing. Some of the issues I noticed are:

  1. Request URL does not include the name of the file you're uploading. Your request URL should be https://colony7.blob.core.windows.net/folder-customer-profilepic/Home - explorar.jpg.
  2. Content type request header is sent as image/jpg. However, in your stringToSign it is set as image/jpeg; charset=UTF-8. Both of them should exactly match.
  3. Content length header is missing in stringToSign.
  4. Based on the documentation here, your stringToSign corresponds to SharedKeyLite however when creating the authorization header, you are using SharedKey.
  5. Your CanonicalizedHeaders does not include x-ms-version.
  6. If you intend to use SharedKey, then your stringToSign should be constructed differently. Please see the documentation link you shared for more details.

Please fix these errors and update your question with the latest screenshots/values.

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