Search code examples
flashswfuploadfallback

SwfUpload Fallback for clients without Flash


Im currently using the SwfUpload (v2.2.0.1) on my asp.net web application with absolutely no issues.

What I would like to do is provide a fall back to a normal upload when the user/client does not have flash installed. I can imagine this could be done with something like jquery replace or similar with the use of a flash detection script.

I do not need to provide a fall back if the user/client does not have javascript.

How would I go about writing this type of fall back or does anyone have any working examples of a swfupload fall back?

Thanks in advance.


Solution

  • Seems the best approach is to use Flash detection as recommended by adobe here Adobe Flash Detection or this similar question on StackOverflow

    Once the test is complete we could show / hide a div or input based on the results.

    Something like this (jQuery / JS):

    var swfu;
    
    if (browserHasFlash() == false) {
       $("#flashUpload").hide();
       $("#regularUpload").show();
    }
    else {
        //Init SWF Upload
        swfu = new SWFUpload({
            upload_url : "http://www.swfupload.org/upload.php",
            flash_url : "http://www.swfupload.org/swfupload.swf",
            file_size_limit : "20 MB"
        });
    }