ngCordova FileTransfer 플러그인을 사용하여 AWS-S3에 사전 서명 된 URL을 사용하여 파일을 업로드하려고합니다.ngCordova FileTransfer AWS S3에 직접 업로드 WebKitFormBoundary 문제
나는 성공적으로 AWS-S3에 파일을 업로드 할 수 있어요하지만 파일의 내용은 이미지 파일을 열 수 없습니다 때문에되는
------WebKitFormBoundarylCFgJXqqECF1rJ2m Content-Disposition: form-data; name="file"; filename="75cae09191bd92a16c3ff05baeb88b9b.jpg" Content-Type: image/jpeg
이 포함되어 있습니다. 어떻게 파일에서이 헤더를 제거 할 수 있습니까? 폼 데이터 대신 바이너리 데이터를 넣으면 POSTMAN에서 테스트했지만 코드로 파일 전송에서이 작업을 수행 할 수있는 방법을 찾을 수 없다는 생각을 가지고 있습니다.
$cordovaFileTransfer.upload(s3SignedUrl, imagePathOnPhone, {
fileKey: "file",
fileName: localFileName,
httpMethod: "PUT",
mimeType: 'image/jpeg'
})
.then(function (result) {
console.log(result);
}, function (error) {
console.log(error);
}, function (progress) {
console.log(progress);
});
내 버킷은 프랑크푸르트 지역 및 api v4에 있습니다. 그리고 서버에서 nodejs를 사용하고 있습니다.
봅니다 "의 Content-Type"을 추가. – daserge
예 : https://github.com/apache/cordova-plugin-file-transfer/blob/855def11c3c35df6f9de10ccca46e7336baa2506/tests/tests.js#L1273-1276 https://github.com/apache/cordova-plugin-file- transfer # example-with-upload-headers-and-progress-events-android-and-ios-only – daserge
나는 행운을 시험해 보았습니다. –