【发布时间】:2017-12-15 21:01:57
【问题描述】:
我在尝试将图像上传到 Azure 存储帐户时遇到问题。问题在于配置标头正确地向服务器发出请求。我已经用邮递员对这个进行了测试,让自己发出请求,并且像一个魅力一样工作,但是当尝试使用 $http.put 从角度做它时,它给了我错误
400(验证信息的格式不正确。检查授权头的值。)
这是我的javascript函数
uploadToAzure: function (urlToUpload, fileType, file) {
var formattedUrl = urlToUpload.split('"')[1];
var fecha = new Date();
var config = {
headers:{}}
config.headers = {
'x-ms-blob-type': 'Blockblob',
'x-ms-blob-content-type': fileType,
'x-ms-date': fecha,
'x-ms-version': '2017-04-17',
//'Host': 'necesito1.blob.core.windows.net',
'Authorization_Token': 'SharedKey <myAccount>:<MyPublicAccessKey>'
};
return $http.put(urlToUpload, file._file, config);
我已阅读这些文章,在那里我发现了如何正确配置我的标题 Doc1////Stackoverflow answer
如果有帮助,我会从邮递员那里得到这个标题
我在这里遗漏了什么吗?任何帮助将不胜感激。
【问题讨论】:
标签: angularjs azure http-headers azure-storage