"fileObj.type has no properties"

For some reason whenever I upload certain files, I get the JS error "fileObj.type has no properties" which leads me to believe that for some reason the file can't be uploaded. This error seems to only occur in OS X, uploading the same files from XP works without any problems.

However it does not happen with all files, only certain ones and then very consistently (so if a file doesn't work it never works, and if it does it always will). Any idea what might be the cause? Is there any additional information I could provide that might help zero in on the problem?

I forgot to mention that

I forgot to mention that this issue is consistent across all browsers (tried it in FF, IE7, Safari, and Opera on OS X with the same results).

Debug Output

It's been awhile since I worked with this, but I remembered the debut setting. So here's the debug output I get (looks like everything seems normal from the perspective of the SWF):


SWF DEBUG: ----- SWF DEBUG OUTPUT ----
SWF DEBUG: Build Number: SWFUPLOAD 2.0.2 FP9 2008-01-07 0001
SWF DEBUG: movieName: SWFUpload_0
SWF DEBUG: Upload URL: /Workspace/nwilliams/betterthanftp/html/files_upload.php
SWF DEBUG: File Types String: *.*
SWF DEBUG: Parsed File Types:
SWF DEBUG: File Types Description: All Files (*.*)
SWF DEBUG: File Size Limit: 41943040 bytes
SWF DEBUG: File Upload Limit: 0
SWF DEBUG: File Queue Limit: 0
SWF DEBUG: Post Params:
SWF DEBUG: PHPSESSID=f2c1aa65ac140f73ad43ce746fdb7c3b
SWF DEBUG: ----- END SWF DEBUG OUTPUT ----
SWF DEBUG:
Flash called back and is ready.
SWF DEBUG: Event: fileDialogStart : Browsing files. Single Select. Allowed file types: *.*
SWF DEBUG: Select Handler: Files Selected from Dialog. Processing file list
SWF DEBUG: Event: fileQueued : File ID: SWFUpload_0_0
SWF DEBUG: Event: fileDialogComplete : Finished adding files

And when I attempt to click my upload button, I get this:


SWF DEBUG: StartUpload(): Starting Upload: First file in queue
SWF DEBUG: StartFile: First file in queue
SWF DEBUG: Event: uploadStart : File ID: SWFUpload_0_0

Then I wait for a very long time and try clicking again and get this:


SWF DEBUG: StartUpload(): Upload run already in progress

So for some reason it looks like it's just not grabbing the file, but I can't imagine why. The same files upload fine when I send them over to my XP machine and try from there, so it seems to be an OS X related issue.

Looking through the JS I can

Looking through the JS I can see that the issue arises when the fileQueued event handler is called. For some reason, the file object (in this case 'fileObj') seems to be null.

gyphie's picture

I have had that happen at

I have had that happen at seemingly random times during testing. An upload is in progress but nothing seems to be happening. Clicking upload again just says an upload is in progress.

I'm not sure why you are getting the fileObj.type error. You're sample debug output doesn't seem related to that issue.

So it turns out the

So it turns out the fileObj.type property was the only thing that was null. As soon as I commented out everythign in the handler that used this it worked fine (perhaps on OS X the type is not always easily retrieved).

As an alternative I just parsed out the extension from the original file name. This isn't going to be 100% acurrate, but it's better than not working at all.

gyphie's picture

Bug

file.type should not be null. I consider that a bug. I'm going to make it so if the type is not provided then type will be an empty string ("").

file.type on OS X

+1 - I am also noting that file.type is often null on Mac OS X - swfUpload 2.1.0