Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to access the key returned from amazon after uploading #615

Open
ibrahem-kamal opened this issue Dec 7, 2021 · 1 comment
Open

how to access the key returned from amazon after uploading #615

ibrahem-kamal opened this issue Dec 7, 2021 · 1 comment

Comments

@ibrahem-kamal
Copy link

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

@level09
Copy link

level09 commented Jun 2, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants