When loading a file using filepicker.io, a call to filepicker.pick is called before the file is actually available. Here is the 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 get the url in inkBlob that comes in the callback, but sometimes, if I insert this url in dom (as above), I get 404. In other cases, this works. I am looking for a reliable way to find out when I can use the file returned by filepicker. I realized that this was the answer, but it seems to be a race condition.
I understand that I can wrap a success callback in setTimeout, but that seems messy, and I don't want the user to expect if the file is really available.
source share