filepicker.io - Ink file picker callback called too early. How to detect when the file is available? -


when uploading file using filepicker.io, filepicker.pick success callback getting called before file available. here's code:

        filepicker.pick({             mimetypes: ['image/*'],             container: 'modal',             services:['computer', 'facebook', 'instagram', 'webcam']         },         function(inkblob){             $('img.foo').attr('src', inkblob.url);         },         function(fperror){             console.log(fperror.tostring());         }); 

i url in inkblob comes in callback, if insert url dom (as above), 404. other times works. i'm looking reliable way know when can use file returned filepicker. figured success callback it, there seems race condition.

i realize wrap success callback in settimeout, seems messy, , i'd not keep user waiting if file available.

you can use event listener.

i have ajax call downloads image after it's cropped ink. call failing sporadically. fixed doing following:

filepicker.convert(myblob,      {          crop: cropdimensions     },     function(croppedblob) {          function downloadimage() {              ...         }          var imageobj = new image();         imageobj.onload(downloadimage()); //only download when image there         imageobj.src = croppedblob.url;     } ); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -