I am working on a project and should upload the file to s3. Here is my code:
config = $.extend(Photo.Plupload.config, config);
var uploader = new plupload.Uploader({
runtimes:'flash,silverlight',
browse_button:config.select_button,
max_file_size:config.max_file_size,
url:'http://' + Photo.Album.Form.bucket + '.s3.amazonaws.com/',
flash_swf_url:'/assets/plupload/js/plupload.flash.swf',
silverlight_xap_url:'/assets/plupload/js/plupload.silverlight.xap',
init:{
FilesAdded:function (up, files) {
},
FilesRemoved:function (up, files) {
}
},
multi_selection:true,
multipart:true,
multipart_params:{
'key':config.key + '/${filename}',
'Filename':'${filename}',
'acl':config.acl,
'Content-Type':config.content_type,
'success_action_status':'201',
'AWSAccessKeyId':Photo.Album.Form.access_key_id,
'policy':Photo.Album.Form.policy,
'signature':Photo.Album.Form.signature
},
filters:[
{
title:config.filter_title,
extensions:config.filter_extentions
}
],
file_data_name:'file'
});
uploader.init();
uploader.bind('FilesAdded', function (up, files) {
console.log(files);
$.each(files, function (index, value) {
value.name = "thumb_" + value.name;
});
console.log(files);
console.log(up);
uploader.start();
});
uploader.bind('UploadProgress', function (up, file) {
});
uploader.bind('Error', function (up, error) {
alert('- . Firebug .');
console.log('Expand the error object below to see the error. Use WireShark to debug.');
console.log(error);
});
uploader.bind('FileUploaded', function (up, file) {
Photo.Album.Form.post(file)
up.refresh();
});
The code is working. I upload the file to S3 and get a valid response that I send to process the server. It also resizes client images.
What I'm trying to do now is send a sketch to the server along with the source file. As far as I know, it is impossible to enter several resize parameters in the plupload initializer. What can I do to send not only the source file, but also its modified version to S3? Can I also resize files directly on Amazon?
I am trying to avoid the possibility of downloading a file and resizing my server and downloading it in different resolutions.
Thanks in advance.