xmlhttprequest를 사용하여 파일을 s3에 업로드하려면 어떻게해야합니까? 나는 다음과 같은 방법을 시도했지만 오류가 발생했습니다.xmlhttprequest를 사용하여 aws s3에 파일을 업로드하는 방법
내 코드?'이 작업에는 익명 액세스가 허용되지 않습니다.' 이 코드와 아무 잘못이
const xhr = new XMLHttpRequest(); xhr.open('PUT', "https://region.amazonaws.com/bucket-name/"); xhr.setRequestHeader('X-Amz-ACL', 'public-read'); xhr.setRequestHeader('Content-Type', 'image/png'); xhr.send({ file: file, type: 'image/png', name: "myfile_9898_0", acl: 'public-read', AWSAccessKeyId: 'aws key', AWSSecreKeyId: 'scret_key' });
있습니까 : 여기
아무도 도와 줄 수 있습니까?
(POST, PUT)에 대해 CORS를 버킷의 allowmethods로 구성 했습니까? – vrn53593
예, CORS for (POST, PUT)를 이미 구성했습니다. '익명 액세스가이 작업에 금지되어 있습니다'와 같은 응답을 받고 있습니다. –
이 [link] (https://gist.github.com/joaoffcosta/5729398)가 도움이 될 수 있습니다. – vrn53593