YUI Uploader Updated

The uploader I wrote and talked about in YUI Upload Implementation has been updated to work with YUI 2.6.0 and also with the new Flash security rules for browsing files. The changes were relatively minor, but here’s a quick explanation.

A new element had to be added that could overlay the button that lets you select files. Once the JS fires it makes that element the exact same size/position of the button you can see and then the YUI Upload fills that overlay with a flash object. While the button still exists when you click the event is actually captured by the flash object. This gets around the tighter flash security rules while not changing the upload experience at all. It’s not a perfect solution but at least the uploader works again.

Changed code looks like this in upload.js

var button = YUD.getRegion('browse');
var overlay = YUD.get('btn_overlay');
YUD.setStyle(overlay, 'width', button.right - button.left + "px");
YUD.setStyle(overlay, 'height', button.bottom - button.top + "px");
YUD.setStyle(overlay, 'top', button.top + "px");
YUD.setStyle(overlay, 'left', button.left + "px");
this.uploader = new YAHOO.widget.Uploader('btn_overlay');

Updated uploader still lives at http://tivac.com/upload/

One Response to “YUI Uploader Updated”

  1. This is not a mundane detail, Michael. » SWFUpload with flash 10:

    [...] Pat wrote about fixing the flash 10 issue with the YUI libraries. [...]

    December 2nd, 2008 at 1:45 am