Getting "undefined (null) " as file type in dialog, and dialogComplete function not being called

jgrunau's picture

I'm creating the SWFUpload as follows:

var settings_object = {
upload_url : "http://localtest.lotus.com/filer/filer2/swfupload/upload.php",
flash_url : "http://localtest.lotus.com/filer/filer2/swfupload/swfupload_f9.swf",
file_types : "*.*",
file_dialog_complete_handler : files_selected,
debug : true };
swfu = new SWFUpload(settings_object);

However, my dialogComplete handler is never invoked, and even though I have set file_types to "*.*", I'm seeing "undefined (null)" in the dropdown of the dialog.

Plus, when I turn on debug output, this is what I see:

----- SWFUPLOAD SETTINGS ----
ID: undefined
upload_url: http://localtest.lotus.com/filer/filer2/swfupload/upload.php
file_post_name: Filedata
post_params: {
}
file_types: *.*
file_types_description: All Files
file_size_limit: 1024
file_upload_limit: 0
file_queue_limit: 0
flash_url: http://localtest.lotus.com/filer/filer2/swfupload/swfupload_f9.swf
flash_width: 1px
flash_height: 1px
flash_color: #FFFFFF
debug_enabled: true
user_upload_complete_handler: function (file) {
}
----- SWFUPLOAD SETTINGS END ----

Why does it say "user_upload_complete_handler" instead of indicating that it is the dialogComplete handler that I've set? And why does it seem to know I set file types to *.* when the dropdown shows "undefined (null)"? I wanted to catch the dialogComplete event in order to gather and process (and display) the list of files the user has selected, before giving them a chance to upload them.

I'm attaching a picture of the dialog.

gyphie's picture

Not sure

I'm not sure what would be causing this issue. You should define a file_types_description setting with the text you want it to show.

It looks like you are using a plugin (that is where the user_upload_complete_handler setting is coming from, it has nothing to do with your file_dialog_complete_handler setting). Which plugin? It may have a bug.

jgrunau's picture

A little more info ...

Ok, so it turns out this is *ONLY* happening with my "second" instance of FireFox. I'm running two instances, each with its own profile. The primary instance, which is where I do most of my everyday browsing, and which has quite a few currently-open tabs, is working fine.

The second instance (which I launch with -no-remote -ProfileManager on the command-line) has far fewer plugins and add-ons than my primary instance. It's what I use when I want to debug something that might crash the browser, since I usually only keep two or three concurrent tabs open at a time in this instance. I have only a handful of add-ons in this instance: DOM inspector, Firebug, Web Developer, "Talkback", and a Realplayer thing. The only ones I explicitly installed are Firebug and Web Developer.

Both instances of Firefox have Flash 9.

Maybe this is a bug in the way Firefox runs multiple instances. Sad Flash does seem to work per se (for instance I can log onto flickr with this instance and use the flash-based widgets there). But SWFUpload is definitely not working normally in this instance. Your website's demos don't work either in this instance: the dialogs will come up, but they show "Undefined (null)" as well in their dropdowns, and nothing happens after you close the dialog. On your "FeaturesDemo" page, SWFUPload always shows that it's "not loaded".

jgrunau's picture

FYI -- it was a flash version problem

Turns out that my second instance of Firefox really didn't have flash 9 installed, and I was loading the swfupload_f9.swf version. Once I upgraded to 9, it started working. Smiling