API (JAVA & Springboot) からバイト配列を受信しています。ここで、javascript File オブジェクトを作成し、そのファイルを FileUploader(angular-file-upload) に渡します。
$scope.reply_query_attachment = new FileUploader({
'queueLimit': '20',
headers: {'Access-Control-Allow-Origin': '*'}
});
I tried to add a file to this File uploader queue
let file = new File([byteArr], 'test.pdf')
let fileItem = new FileItem($scope.reply_query_attachment,file,{});
$scope.reply_query_attachment.queue.push(fileItem);
angular.forEach($scope.reply_query_attachment.queue, function (value, index) {
value.url = "https://" + $scope.url;
value.formData.push({'key': $scope.key + $scope.reply_query_attachment.queue[index].file.name,
'AWSAccessKeyId': $scope.accessKey,
'acl': 'private',
'policy': $scope.policy,
'signature': $scope.signature,
'success_action_status': '201'
});
});
$scope.reply_query_attachment.uploadAll();
しかし、アップロードされたファイルは常に破損しています。バイト配列から有効な JavaScript ファイル オブジェクトを作成できませんでした。 バイト配列を Fileuploader キューに追加する方法はありますか?