Rank: Member
Groups: Member
Joined: 10/23/2009(UTC) Posts: 26
Thanks: 3 times
|
I need to access response object headers from the client after image is uploaded to Amazon S3. I tried afterUpload(response) event for the Uploader, but the response parameter is just an empty string. I need the location (URL) returned by S3 for each uploaded image, e.g. function onS3Done(e, data) { var s3Url = $(data.jqXHR.responseXML).find('Location').text(); var s3Key = $(data.jqXHR.responseXML).find('Key').text(); }; Any suggestions on how to do it? Thanks
|
|
|
|
Rank: Member
Groups: Member
Joined: 4/12/2016(UTC) Posts: 12
Was thanked: 3 time(s) in 3 post(s)
|
Hello. Unfortunately, you can't get response headers from uploader request. You can construct an array with object {url, key} before upload. And put new name to file in before request event. The The uploader will upload file by file and converter by converter. So you can get all keys and urls at upload start. Quote:var arr = []; var caverter1Path = "folder1/"; var caverter2Path = "folder1/"; var key = ""; var url = "http://your-bucket.s3.amazon.com/"; for(var i=0 ;i<this.files().cont(); i++){ key = caverter1Path + i+ this.files().get(i).name() arr.push({url:url + key ,key: key}); key = caverter2Path + i+ this.files().get(i).name() arr.push({url:url + key ,key: key}); } Edited by user Monday, January 16, 2017 3:01:58 AM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Member
Groups: Member
Joined: 10/23/2009(UTC) Posts: 26
Thanks: 3 times
|
Ok, got it. Would be nice if you add the ability to read response headers from the server, not just the response body.
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
The idea is sound reasonable, so we will consider it. Thanks!
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.