Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uploadify ruins file upload when no flash in browser

I have an HTML form with a file upload element, which is based on Uploadify. Unfortunately, if the browser doesn't have flash installed/enabled (I tested on Chrome and Safari), then the file upload element is completely disappearing, while I would have expected to have at least plain, regular, file upload html element as a fallback.

You can see this behavior even in Uploadify official demo (as of today, 28.2.2011):

http://www.uploadify.com/demos/

Anyone found his way around this? Cheers


none of these work in the situation that flash is installed, but is disabled !
for example, this line:

if (swfobject.getFlashPlayerVersion().major === 0)

behaves the same weather flash is installed and enabled, or installed and disabled !
I thought about obtaining uploadify API and checking it, but I have found zero examples, any ideas?

like image 392
Nir O. Avatar asked Feb 28 '11 00:02

Nir O.


2 Answers

I use the onSWFReady event, which isn't triggered if flash is disabled of course. I remove the block containing the native file input and show the uploadify div if swf is loaded, works like a charm:

onSWFReady: function() {
    $('#property-post .upload .browse').remove();
    $('#uploadify').css('display', 'block');
}
like image 152
valmarv Avatar answered Sep 22 '22 23:09

valmarv


If you are using the latest version of uploadify you can use the onFallback event to detect if flash is installed (or if the required flash version of flash is supported):

$("#file_upload").uploadify({
    'swf'        : '/uploadify/uploadify.swf',
    'uploader'   : '/uploadify/uploadify.php',
    'onFallback' : function() {
        alert('Flash was not detected or flash version is not supported.');
    }
});
like image 28
George Filippakos Avatar answered Sep 19 '22 23:09

George Filippakos