squeezemylime
squeezemylime

Reputation: 2102

filepicker.io bombing out on upload to S3 in Meteor app

I am working on a file uploader for my app and I settled on Filepicker.io. Everything is working fine except for one thing..When I upload an image to S3 I can only upload the URL that Filepicker returns (not the image itself).

The below is successful, but

Template.new_aphorism.events({
'change #attachment': function(event){  

    var savedFile = JSON.stringify(event.fpfile);
    var parsedJSON = eval('('+savedFile+')');
    var url=parsedJSON.url;
    $('input[name=new_aphorism_image]').val(url);
    console.log("saved file is:" + savedFile);
    console.log(url);

    filepicker.store(url, {location: 'S3'}, function(fpfile){
           output.html('Uploaded: '+fpfile.filename+'');
    }, function(fperror){
        output.text(fperror.toString());
    }, function(progress){
        output.text("Uploading... ("+progress+"%)");
    });
 }
});

I get back as my message:

File stored in S3 at VnAa2YsOS6wOECNMWpwn_temp.txt and available at https://www.filepicker.io/api/file/vVtWTOl7QqOJ7gPmXkHQ

I have tried passing this and event.fpfile into my filepicker.store function but it just doesn't work.

Upvotes: 3

Views: 548

Answers (1)

squeezemylime
squeezemylime

Reputation: 2102

Solved.

In the same function:

var file = event.fpfile;
filepicker.store(file, {location: 'S3'}, function(fpfile){

Upvotes: 1

Related Questions