amazon s3 - Cannot load more than 2 files to S3 using plupload -
my code below works fine long load 2 multiple files. if load 3 or more, every file after 2nd 1 not added s3 bucket (although no error shown plupload).
can understand why?
var uploader = new plupload.uploader({ browse_button: 'browse', // can id of dom element or dom element url: 'https://s3.amazonaws.com/mybucket', filters: { max_file_size: '25mb', prevent_duplicates: true, multiple_queues: true } }); uploader.init(); uploader.bind('filesadded', function (up, files) { plupload.each(files, function (file) { var myfilename = file.name.tolowercase(); myfilename = myfilename.replace(/[|&;$%@"<>()+,]/g, ""); var elem = $('#hfreplyguid'); $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", datatype: "json", url: "webservice.asmx/prepareupload", data: "{'acl':'private','bucket':'mybucket','file':'" + folderpath + elem.val() + "_" + myfilename + "'}", success: function (data) { params[myfilename] = { policy: data.d[0].policy, signature: data.d[0].signature }; var multipart_params = { 'key': folderpath + elem.val() + "_" + myfilename, 'filename': folderpath + elem.val() + "_" + myfilename, 'awsaccesskeyid': awsaccesskey, 'acl': 'private', 'signature': params[myfilename]["signature"], 'policy': params[myfilename]["policy"], 'success_action_status': '201' } up.setoption('multipart_params', multipart_params); uploader.start(); }, error: function (xhr, ajaxoptions, thrownerror) { alert(xhr.status); alert(xhr.responsetext); alert(thrownerror); } }); }); });
i solved basing code on post upload multiple files amazon s3 using plupload
however had create policies in filefiltered event, start uploader in filesadded event , add each policy in beforeupload event below:
var multipart_params = policies[file.id]; up.setoption('multipart_params', multipart_params);
Comments
Post a Comment