1
아마존 s3 버킷에 pdf 파일을 업로드하고 싶습니다. 하지만 파일 경로가없는 파일 업로드를 받고있다ionic 3 앱에서 amazon s3 버킷으로 pdf 파일 업로드
귀하의 문제가이 코드로 자리 잡고var filepath = "";
var that = this;
this.fileChooser.open()
.then(uri => {
console.log(uri);
filepath = uri;
var fileName = 'File_' + this.global.gerUniqueString() + ".pdf";
var AWSService = window.AWS;
AWSService.config.accessKeyId = this.global.accessKeyId;
AWSService.config.secretAccessKey = this.global.secretAccessKey;
AWSService.config.region = 'ap-south-1';
var bucket = new AWSService.S3({ params: { Bucket: this.global.bucketName } });
var body = 'data:application/pdf', base64, filepath;
var params = { Key: fileName, Body: body };
bucket.upload(params, function (err, data) {
console.log(err, data);
});
})
.catch(e => console.log(e));