Search code examples
phpjqueryhtmlfile-uploaduploadify

Why is the upload button shown so slowly?


I am working on an existing project. I use the jQuery Uploadify plugin to upload files. The following button code is used to upload files:

<div>
     <input width="167" type="file" height="47" name="file_upload" class="file_upload" id="file_upload" style="display: none;">
     <object width="167" height="47" type="application/x-shockwave-flash" data="/uploadify/uploadify.swf" id="file_uploadUploader" style="visibility: visible;"><param name="quality" value="high">
         <param name="wmode" value="transparent">
         <param name="allowScriptAccess" value="sameDomain">
         <param name="flashvars" value="uploadifyID=file_upload&amp;pagepath=/en/media-maker/&amp;script=/en/media-maker/upload/file&amp;folder=&amp;scriptData=level%3D1%26folderid%3D15%26symfony%3Dbtt461h1nor36k2taotp6jhku4&amp;width=167&amp;height=47&amp;wmode=transparent&amp;method=POST&amp;queueSizeLimit=20&amp;simUploadLimit=1&amp;hideButton=true&amp;fileDesc=Image / Video / Audio&amp;fileExt=*.jpg;*.jpeg;*.gif;*.png;*.bmp;*.svg;*.avi;*.divx;*.dvx;*.dv;*.asf;*.asx;*.3gp;*.3g2;*.3ivx;*.3vx;*.mov;*.mp4;*.m4v;*.mpg;*.mpeg;*.qt;*.rm;*.swf;*.wmv;*.mkv;*.mts;*.part;*.mp3;&amp;multi=true&amp;auto=true&amp;sizeLimit=524288000&amp;fileDataName=Filedata&amp;queueID=uploadList">
     </object>
</div>

My problem is that this button appears very late when I refresh the webpage. This button appears only after the whole page is uploaded. Sometimes this button does not appear on some browsers and slow internet connection. How do I make it appear faster?

Thanks


Solution

  • If the <object> is your button and it's some sort of .swf flash file ... well the browser can't display it until it downloads the whole thing from /uploadify/uploadify.swf ... Not to mention it has to fire up the flash plugin just to render a simple button. This is why it's slow.

    I can't say I would ever advocate using a flash file for a button when CSS has is now so well-supported by so many browsers. I might go so far as to call it completely nonsensical.