我上传图片从fileURI所亚马逊下面这个非常简单的方法科尔多瓦文件传输到S3 AWS返回501错误
window.resolveLocalFileSystemURI(fileURI, function(fileEntry) {
fileEntry.file(function(fileObj) {
console.log("Size = " + fileObj.size);
var options = new FileUploadOptions();
options.chunkedMode = false;
options.httpMethod = 'PUT';
options.headers = {
'Content-Type': 'image/jpeg',
'Content-Length' : fileObj.size
};
var ft = new FileTransfer();
constructSignedUrl(picname, 'put').then(function (url) {
console.log(url)
ft.upload(fileURI, url,
function (res) {
deferred.resolve();
},
function (error) {
deferred.reject();
},
options);
});
});
});
的constructSignedUrl(picname,“放”)是构建presigned网址的方法。这是工作,我测试的是细跟邮递员
服务器返回该错误
Message>A header you provided implies functionality that is not implemented</Message><Header>Transfer-Encoding</Header>
好像上传文件传输将报头,我不能得到摆脱它,我该如何解决这个问题?
UPDATE:在检查上查尔斯代理负载我看到的标题
Transfer-Encoding chunked
仍然存在,如何可以覆盖它。我已经将分块模式设置为假。
' '内容长度':“0''?你在告诉S3你正在上传一个空文件? –
我重新修改并重新测试了内容长度为文件大小的函数。但仍然得到相同的错误 –
是否有必要明确设置Content-Length? –