我一直在试图使用Postman将图像上传到我的Blob容器文件夹。这是我使用的链接Azure存储服务REST API的授权来生成签名,并在正文中附加了文件名文件字段。请注意,保留HTML标签。
var key = "[Storage account key]";
var strTime = (new Date()).toUTCString();
var strToSign = 'PUT\n\nimage/jpeg; charset=UTF-8\n\nx-ms-date:' + strTime + '\nx-ms-meta-m1:v1\nx-ms-meta-m2:v2\n/colony7/folder-customer-profilepic/Home - explorar.jpg';
var secret = CryptoJS.enc.Base64.parse(key);
var hash = CryptoJS.HmacSHA256(strToSign, secret);
var hashInBase64 = CryptoJS.enc.Base64.stringify(hash);
var auth = "SharedKey colony7:"+hashInBase64;
我已经使用了这些 https://learn.microsoft.com/zh-cn/rest/api/storageservices/put-block, https://learn.microsoft.com/zh-cn/rest/api/storageservices/authentication-for-the-azure-storage-services,以上代码的引用。
我也开启了 CORS。请告诉我如何使用 Postman 上传 JPG 或 PNG 图像到我的 Blob。
提前致谢。