Mar 07

SWFUpload stuck on pending

Category: Linux   — Published by tengo on March 7, 2012 at 5:33 am

Switch on debugging and depending on your swfupload version it tells you either "Invalid function name: StartUpload" or "Call to StartUpload failed". Even more strange, it sometimes happens, sometimes doesn't, depending on if the page was loaded or reloaded.

The solution is: it's caused by the swfupload element, the button, being inside a DOM element that is hidden, and when the browser loads the page, from cache or directly, it confuses if it should load handler.js first or the swfobject. It's not an IE or FF specific issue. The developers tell us they are working on this, but that was 2008!

The solution is to not hide the DOM element, but use a technique like the off-left trick descirbed here:
Use a CSS like left: -10000px; instead of display:none.