jquery uploadify

14,231

Solution 1

You should see accepted answer in this thread. The key is to call the $("#uploadify").uploadifySettings(); inside upload start handler, or form submit handler.

Overall, the js code should be like this:

jQuery(function($){

  //make uploadify
  $("#uploadify").uploadify({params});

  //handle form submit
  $("#form").submit(function(e){
    //prefent form submit
    e.preventDefault();

    //change the uploadify setting, ex. scriptData
    $("#uploadify").uploadifySettings("scriptData", {'file_id': '345'});

    //start upload
    $("#uploadify").uploadifyUpload();

  });
});

This code work for me, I hope it work in your case. Form submit can be replaced by another function, such as in function startUpload that exist in example script from uploadify website.

Solution 2

I am struggling with the same problem.

Someone over at the Uploadify forums thinks it is a bug related to the situation where the parent element had the style display:none.

http://www.uploadify.com/forum/viewtopic.php?f=7&t=2163

Share:
14,231
David
Author by

David

Wheeeee!!

Updated on July 12, 2022

Comments

  • David
    David almost 2 years

    Okay, i can't post all the code to this because it's just unnecessary. But here's the problem.

    I have a tabbed dialogue (ui.tabs) which contains an uploadify form for uploading files. However on an earlier tab I check the status of a radiobutton to determine whether to allow only image files or flash files.

    I have initialized uploadify as such beforehand, within $(document).ready:

    $("#uploadify").uploadify({params});
    

    ... including 'fileDesc' and 'fileExt' parameters. In itself, it works fine. But once it has been initialized, I wish to alter the settings using:

    $("#uploadify").uploadifySettings('fileDesc','blah blah');
    $("#uploadify").uploadifySettings('fileExt','.ext');
    

    ... but when i do this, Firebug spouts the following:

    document.getElementById(a(this).attr("id") + "Uploader").updateSettings is not a function http://localhost/projectname/Javascript/jquery.uploadify.v2.1.0.min.js Line 26

    Now obviously there is nothing wrong with uploadify itself, but I may be a total noodle here. Is this happening because it thinks that '#uploadify' hasn't been initialized yet?