vue-dropzone icon indicating copy to clipboard operation
vue-dropzone copied to clipboard

how to access the key returned from amazon after uploading

Open ibrahem-kamal opened this issue 3 years ago • 1 comments

i need to get the key returned from amazon after uploading the file but i can see that u only return the file location in the payload

ibrahem-kamal avatar Dec 07 '21 11:12 ibrahem-kamal

You can get it form the files, they will have an xhr object containing the response in XML format, you only need to parse that

const f = app.$refs.dropzone.getAcceptedFiles()[0];
const parser = new DOMParser();
const awsRes = parser.parseFromString(f.xhr.response,'text/xml');

console.log(awsRes.getElementsByTagName('Location')[0].innerHTML); // <- this is your s3 locaiton
console.log(awsRes.getElementsByTagName('ETag')[0].innerHTML); // <- this is your ETag

level09 avatar Jun 02 '22 09:06 level09