Last Updated: February 25, 2016
· causztic

event is not defined on Firefox with Filepicker

I was writing a piece of code with a cropper and filepicker and wanted to update the cropper with the uploaded file so that users can manipulate it immediately.

The image url is stored on event.fpfile.url, so I tried accessing it with this method

$(document).on("change", cover_img, function(){
placeholder = "cover-img";
$(placeholder).attr("src", event.fpfile.url + '/convert?"');
... });

...which works on all browsers...except Firefox :\

I read up that Firefox is the only browser that does not have the global event variable, so I tried passing in like

function(event){ event.fpfile.url ... }

and via accessing dice.

However, doing it like

function(event){ event.originalEvent.fpfile.url ... }

works! throws confetti