4

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?

6 Answers 6

3

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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

2 Comments

that could very well be the problem ... although i'm not gonna attempt to 'fix' it while it's working, i've bookmarked the link for future reference. :)
Broken link, please don't break the internet ;-)
0

You presume that #uploadify hasn't been initialized yet. Did you put your uplaodify code into

$(document).ready(function() { ... });

?

3 Comments

One more thing: are the swf scripts placed on the server accessible? Not sure, but seems like uploadify dynamicaly embeds them in the page...
I did, as mentioned above, it's sitting on localhost, i have access to the script (it works just fine on it's own, i just can't seem to change the settings with uploadifySettings. I just don't know... Yes, it is in document.ready.
Okay, it doesn't answer the question really, so i'm still open for a response. But in order to get it to work, i've simply re-initialized the whole thing upon click of the radio buttons, simply to get it to work. NOT an ideal solution at all. So i'm still open to ideas of actually having it correct...
0

I got this error when using Uploadify inside a jquery dialog box.

The solution was to initialize Uploadify after the dialog was created.

Comments

0

IE can cache the uploadify.swf file, and for some reason, this will cause a failure for some users. In the Uploadify setup configuration, modify the "uploader" URL to include a unique value in the querystring to prevent caching:

'uploader': '/Content/uploadify.swf?nocache=' + new Date().getTime()

This fixed the issue for me.

Comments

-1

Try

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

1 Comment

A fair response, but that is what I tried first time around - when that didn't work I simplified it into the code mentioned above. I still get the 'updateSettings is not a function' error. :\

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.