Monday 15 April 2013

Filepicker.io — Stop .pickMultiple From Automatically Storing File In S3 Bucket -


I am trying to use Filepicker.io as an uploader, but one for every file in the payload I have to fire the onSuccess event. Using Combination of pickMultiple and .store methods. Like:

  filepicker.pickMultiple (function (fpfiles) {for (var i = 0; i & lt; fpfiles.length; i ++) {// File name clean / check duplicate // S3 filepicker.store (fpfiles [i] .url, {location: 'S3', path: 'filepicker /' + fpfiles [i] .filename}, store the file on function (my_uploaded_file) {// some other Good stuff ...});}});   

(It is opposed to using the PickAndStore method, which will fire only one onSuccess event after the entire payload transmission is completed)

I have a problem It seems that with it it seems that it seems that PixMultiple method is 'Auto Magical' saving a copy of the file in the root of my S3 bucket; So I'm ending with two copies of the same file. For example:

For example:

If I am uploading my_file.png to a folder in my bucket called images then I should get the result

Which is , but I am also getting:

Anyone has to stop adding a file to their S3 bucket.

Thanks for any help.

For anybody else, that's the problem that can be the same. PickMultiple () one ???? & Gt; The .store () method is a dead end in the payload (only) way to get an onsite event for the every file to fire a vanilla and to get the FILES array of the on-site event element, and then loop through FILES and call for each file (Stars) from the array.

Example:

  $ ('# BTN_upload'). Change (function () {var files = $ (this) [0]. Files; // You can see that the console should upload the logs (JSON.stringify (files)); // each file on SA3 Loop the file array to store for (var i = 0; i & lt; files.length; i ++) {// All are good. Execute the store call filepicker.store (// file). To upload the [i], // file option // (I am storing files in files named 'my_folder' within my S3 Bucket) // it is also Is where you can rename your file, like {path: 'my_folder /' + [[i] .name}, // onsut function (FPFile) {console.log ("Store Success:", JSON .stringify (FPFile); // Now possibly call 'Remove to remove' () from the mp 'file FP.io), // the owner's function (FPError) {console.log (FPError.toString ()); }, // On Progress function (progress) {console.log ("Loading:" + Progress + "%"); }); }}); Filepicker.setKey ('MY_FP.IO_KEY');   

and HTML:

  & lt; Input ID = "BTN_upload" type = "file" />   

This example is not a finished product. You still need to roll your user feedback (like a queue display with progress bar), check duplicate, rename it. But this is all very easy stuff.

Note: I'm not sure how to integrate other sauces on the FOPO tap just for this local-to-S3 upload. perhaps you do?

No comments:

Post a Comment