amazon web services - Sample javascript browser code for uploading multiple files into AWS S3 -
i have searched topic didn't luck. have tried following:
$.each(uploadingdata.files, function(key, value) { file = value; var params = { key: 'content-upload-development/' + file.name, contenttype: file.type, body: file }; bucket.upload(params).on('httpuploadprogress', function(evt){ console.log(1); var percent = parseint((evt.loaded * 100) / evt.total); var signedformdata = null; console.log(percent); $(document).trigger("amazonstatusupdateevent", ["uploading", file.name, percent, signedformdata]); }).send(function(err, data) { var signedformdata = {}; console.log('error is: ' + err); //signedformdata.fileurl = data.location; signedformdata.filesize = "400m"; $( document ).trigger( "amazonstatusupdateevent", [ "completed", file.name, 100, signedformdata ] ); }); if(counter == 0) { file = value; } counter++; });
but doesn't seem work - not sure why, behaviour seems bit strange. event triggering doesn't seem pop well.
i wondering: using loop call bucket.upload() right approach handle this? or there way of doing this?
Comments
Post a Comment