SWFupload with Flash 10 Fix 3

Posted by Ben Reubenstein Tue, 25 Nov 2008 20:58:00 GMT

It took me a while to reproduce errors that users were reporting with the SWFUpload plugin, but I finally traced it to users using Flash 10. Flash 10 changes how javascript and flash are allowed to interact thus breaking the html upload button that calls javascript to present the file choosing dialog box. If you run SWFUpload in debug mode you will get Error #2176. To fix:

  1. Download SWFUpload v2.2.0 Beta 3 Core.zip
  2. (optional) Backup your swfupload.js and your swfupload.swf file
  3. Unzip and overwrite your existing swfupload.js and your swfupload.swf file. You might need to rename the swf to match your swf name. If you try the uploader at this point you will receive a javascript error: SWFUpload Could not find the placeholder element.
  4. Create a button image that will be used instead of the upload html input.
  5. Adjust your JavaScript to include the following attributes:

    button_placeholder_id : "spanSWFUploadButton",
    button_image_url : "http://www.yourdomain.com/yourbutton.png",
    button_width : 61,
    button_height : 22
  6. Add a span tag with the element ID you specified above.

Update: In order for your image to work properly, it must have 4 states. Refer to this post.

If things are still not working for you, be sure to turn debug: true and review the javascript error log. Hope this helps others.