vue-dropzone
vue-dropzone copied to clipboard
how to access the key returned from amazon after uploading
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
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