Jquery uploadify

Well, I can’t post all the code because it is just superfluous. But here is the problem.

I have a tabbed dialog (ui.tabs) that contains an upload form for uploading files. However, on an earlier tab, I check the status of the radio to determine if only image files or flash files are allowed.

I initialized preloading as such in advance, within $ (document) .ready:

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

... including the parameters 'fileDesc' and 'fileExt'. By itself, it works great. But once it has been initialized, I want to change the settings using:

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

... but when I do this, Firebug spits out 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 what you download, but I can be a complete noodle here. Is this because he thinks that '#uploadify' is not yet initialized?

+4
source share
6 answers

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

In general, the js code should look 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 works for me, I hope it works in your case. The submit form can be replaced by another function, for example, in the startUpload function, which exists in the example script from the uploadify website.

+3
source

I am struggling with the same problem.

Someone on the Uploadify forums thinks this is an error related to the situation where the parent element had a style display: none.

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

+1
source

You assume that #uploadify is not yet initialized. You have added uplaodify code in

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

?

0
source

I got this error when using the "Download" function inside the jquery dialog.

The solution was to initialize Uploadify after creating the dialog.

0
source

IE may cache the uploadify.swf file, and for some reason this will crash for some users. In the Uploadify configuration setting, change the "uploader" URL to include a unique value in querystring to prevent caching:

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

This fixed the problem for me.

0
source

Try

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

All Articles