On upload of my first .swf file in Flash Node I received message: must be a valid filename associated with the file upload field. Then I could go no further. I then upgraded to the latest Flash Node mod and also installed SWFTools. Even after that I still get the message demanding a valid filename. It won't upload .swf files. Why?

Thanks for helping me isolate what's missing here.

Drupalgirl

Comments

drupalgirl’s picture

Update:

After upgrade the message changed. It's now demanding this -- "You must specify a Flash file to upload." But, it is a .swf file and upload instructions says: Click "Browse..." to select a swf, flv or mp3 file to upload.

BTW: I have UFO.js and UFO.swf inside of the flashnode/ folder.

Drupalgirl

Stuart Greenfield’s picture

Assigned: Unassigned » Stuart Greenfield

Hmmm, not sure immediately what is wrong there. I will download the latest build from the website to check I haven't accidentally a "broken" version of flashnode.

I'll get back to you as soon as I can!

drupalgirl’s picture

Any word on resolving the .swf upload problem?

Stuart Greenfield’s picture

I'm snowed under with my two regular jobs (work + baby!) so I'm struggling to get round to investigating and fixing, but I'll get on to it as soon as I can.

Two more people have reported what seems to be the same bug. What system are you using to upload the files - the other bug reports imply it works ok under Windows, but not Mac.

It is possible to disable the file check and I am wondering if different browsers are reporting different mime types on upload. If I get a chance soon I'll try to write a debug version to get some feedback, and then see how to rewrite the file check. The sledgehammer option is simply disable file checks completely I suppose!

Please bear with me!

Stuart Greenfield’s picture

I have uploaded a version of flashnode to HEAD with a couple of lines of debug code. When you load a flash file and try to preview/post it should report the content of two strings in a message box at the top. Can you copy/paste that content and post here so I can see what the validation routine is receiving. Thanks!

samyak_bhuta’s picture

Component: User interface » Code
Priority: Normal » Critical

Hi Stuart ,

First of all two kisses to your baby.

I have similar problem but not with SWF file but with Mp3 files.

Whenever I try to upload an .mp3 file using FF it is giving error "The specified file is not a valid format." but same thing works well with IE 6.

My Enviroment Details.

On WinXP with SP2.
I am using XAMPP. ( ApacheFriends XAMPP (basic package) version 1.5.5 )
Firefox : Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.9) Gecko/20061206 Firefox/1.5.0.9.
IE : Version 6.0.2900.2180

Stuart Greenfield’s picture

Thanks for the post - I can do some tests on this as I'm also running Windows/XAMMP and have Firefox, so I'll see if I can create the same bug for MP3s, and then see if that helps any with the SWF issue too!

Stuart Greenfield’s picture

I have done a quick test on my test system running XAMMP under Vista and was able to upload swf, mp3 and flv via IE and Firefox.

This problem seems to be very elusive and is affecting some users but not others. I think it must apply to certain configurations, but I'm not sure what the connection is and whether it sits at the client end or the server end.

I will try to do some more testing...

Stuart Greenfield’s picture

Also meant to say that I can also upload to my host (1and1) via both FF and IE7...

If any other users of Flash node are experiencing this error please can you post below to let me know what configuration (server + clients) are not working for you so I can try and pinpoint the bug.

It looks like I might need to make a debug release that lets you turn the file check on and off as that seems to be the hiccup.

gdw2’s picture

Server:
OSX, XAMMP

Client: FF, Safari, and Opera in OSX (upload fails)
Client: IE7 in Windows (works!?!)

Stuart Greenfield’s picture

I have just uploaded a "debug" version of flashnode to HEAD so it should become available at the next package build. I have changed the upload check slightly and added a few lines that will generate drupal messages during the upload.

If you want to use the debug version then after installing it create a flash node, chooe a file to upload and hit submit (don't preview first). In addition to the "Your Flash has been created." message you'll some info as below. If you could copy the messages and paste them here then it will give me a clue as to what your server is seeing when you create a node.

E.g. the results from my test system are as follows:

swf file
flashnode_prepare: ext = swf, mime = application/x-shockwave-flash
flashnode_prepare: building flashnode object
flashnode_validate: [flashfile][#value] =
flashnode_validate: [flashnode][_flashnode][#value] = flash/temp/HappyBirthdayMum.swf
Your Flash has been created.

mp3 file
flashnode_prepare: ext = mp3, mime = audio/mpeg
flashnode_prepare: building flashnode object
Remember to set the movie size for flv or mp3 files as flash node cannot always automatically determine the player size!
flashnode_validate: [flashfile][#value] =
flashnode_validate: [flashnode][_flashnode][#value] = flash/temp/zoolook.mp3
Your Flash has been created.

flv file
flashnode_prepare: ext = flv, mime = application/octet-stream
flashnode_prepare: building flashnode object
Remember to set the movie size for flv or mp3 files as flash node cannot always automatically determine the player size!
flashnode_validate: [flashfile][#value] =
flashnode_validate: [flashnode][_flashnode][#value] = flash/temp/Test.flv
Your Flash has been created.

gdw2’s picture

mp3 - (didn't work)
* flashnode_validate: [flashfile][#value] =
* flashnode_validate: [flashnode][_flashnode][#value] =
You must specify a Flash file to upload.

swf - (it appears to have worked)
* flashnode_prepare: ext = swf, mime = unknown/unknown
* flashnode_prepare: building flashnode object
* Remember to set the movie size for flv or mp3 files as flash node cannot always automatically determine the player size!
* flashnode_validate: [flashfile][#value] =
* flashnode_validate: [flashnode][_flashnode][#value] = flash/temp/xml_photogallery_user.swf

Stuart Greenfield’s picture

OK.

The swf dump explains why Flash node was rejecting swf files. It was checking the mime type of the uploaded file, but that is reported by the client. In your case (and presumably others) the client is saying unknown/unknown, which would have caused Flash node to reject the file. I'll fix that by asking flash node just to check the file extension.

But the mp3 file never evens get to validation - it's been discarded before Flash node even looks, so it thinks nothing was provided. I will look further at that one!

gdw2’s picture

I just tried uploading an mp3 through a custom type that I created with cck and it gave me a similar error.

In other words: I don't think this is a problem of this module, but a problem with the core.

gdw2’s picture

... problem of the core ... or better yet, the browser or os? (see my comment above... any idea why it lets me upload an mp3 through ie6 on xp, but not with ff or safari on os x?)

gdw2’s picture

Ok... I discovered that it would accept one mp3, but not the other. So the mime type (?) must be bad in the culprit mp3.

Here is the date from my sucessful mp3:
* flashnode_prepare: ext = mp3, mime = audio/mpg
* flashnode_prepare: building flashnode object
* Remember to set the movie size for flv or mp3 files as flash node cannot always automatically determine the player size!
* flashnode_validate: [flashfile][#value] =
* flashnode_validate: [flashnode][_flashnode][#value] = flash/temp/Good_vibrations_edited.mp3
* Your Flash has been created.

I've attached the bad (mime?) file. Maybe checking by extension is best.

Stuart Greenfield’s picture

@gdw2:

I have rewritten the upload routine so it now only checks the file extension to make sure it is either swf, flv or mp3. It no longer checks for shockwave or mp3 mime types.

However, the message dump above for the mp3 upload that DIDN'T work suggests that Drupal rejected the upload before it even got to the _prepare steps of Flash node. I have uploaded another version of Flash node to HEAD. This has a few more debug messages around the file_check_upload and file_save_upload steps to see if that pins down where the file is being rejected - it might actually be "outside" of flash node. That fits with your observation I don't think this is a problem of this module, but a problem with the core.

If you could download the HEAD package when it next builds, try uploading the problem mp3 and posting the results that would be much appreciated. As before, if you could create a flash node and hit submit, not preview.

It looks like removing the mime type check may go a long way toward curing this bug though, so I think we're nearly there!

Thanks for your help in debugging!

Stuart Greenfield’s picture

@samyak_bhuta:

I think the planned change to the upload check (verify extension only, not mime type) will fix your problem with mp3s uploading via IE but not FF.

If you are still tracking this thread you might also like to try the latest HEAD package to see if it now works.

All being well I will commit this version as an official package in the next few days.

gdw2’s picture

mp3:

* flashnode_prepare: doing file_check_upload
* flashnode_validate: [flashfile][#value] =
* flashnode_validate: [flashnode][_flashnode][#value] =

You must specify a Flash file to upload.

Stuart Greenfield’s picture

As you only see the message "flashnode_prepare: doing file_check_upload" then it means the uploaded file is being rejected by the Drupal function file_check_upload. If this is given a file that doesn't pass various checks in this function it returns nothing, and therefore Flash node doesn't ever see a file.

However, in most cases file_check_upload writes a message explaining why the upload failed, but you're not seeing that. I will need to do some more investigation.

From what you've described it is only particular mp3 files that have this problem - others load ok? Would it be possible to mail the problem mp3 to me at web@stuartandnicola.com? I can test the file on my system to see if I can replicate the bug.

Thanks!

Stuart Greenfield’s picture

I got the mp3 file, and I have uploaded successfully on my test site. That seems to pinpoint the error in to the call to Drupal's file handling function file_check_upload, but at first read I don't understand why a particular mp3 should fail and yet others work.

As far as I can tell the check_upload call should either always work (because uploads are running properly) or always fail (because something is going wrong).

Too tired tonight to get my head round this one, but it sounds very puzzling.

I am tempted to commit the first change that is resulting from this thread (check extensions, not mime types) to get that out the way, and then work this issue through.

Are you having problems with any other files / file types, or only this one?

GoofyX’s picture

I too suffer from this specific problem. I upload a .swf file and I get the message

You must specify a Flash file to upload.

I tried with Opera 9.23 and Firefox 2.0.0.7 on Linux.

GoofyX’s picture

And with Konqueror 3.5.7 I get the same message.

GoofyX’s picture

... and same message in IE 6 in Windows XP sp2.

Stuart Greenfield’s picture

OK - I just committed the change to the upload routine so it no longer checks the mime type.

@GoofyX - were using the HEAD version, or the 3.0 package? If 3.0 please can you try the 3.1 release and let me know if you are still experiencing errors.

@gdw2 - I still haven't managed to reproduce the upload failure described here on my system. Could you also try the 3.1 package and check it you still get upload failure messages. I am guessing you probably will, but worth a try!

GoofyX’s picture

Same error, with version 3.1.

GoofyX’s picture

So, any progress with it? I desperately need this module...

I suppose the file is not uploaded at all, because I did a few tests and saw that file_check_upload() inside flashnode_prepare() fails...

Stuart Greenfield’s picture

Are you able to upload the file as a simple attachment? i.e. create a "regular" node, attach the file as an upload and then save it? If that works then it says that only flash node is failing to get the upload through. If you can't attach that way then it says there is a wider issue.

I have never seen this error on my development systems (Windows or Linux) so I'm struggling to understand what is happening!

GoofyX’s picture

Are you able to upload the file as a simple attachment? i.e. create a "regular" node, attach the file as an upload and then save it? If that works then it says that only flash node is failing to get the upload through. If you can't attach that way then it says there is a wider issue.

No, because I'm an idiot. I had not checked the file upload settings in Drupal, my maximum file upload was 4MB, whereas the swf file was 4.1MB (it's a Flash game). So, after researching a bit (I could not increase the max file upload size at once), the file is attached and the flash node is created.

However, now I get a different kind of error. The file is saved under files/flash, but when I try to view the node, I get this message four times:

Could not display the flash because "files/flash/temp/turretdefense2.swf" does not appear to exist.

It tries to find the swf file at the wrong folder.

Stuart Greenfield’s picture

files/flash/temp is the "holding" area that flash node uses during the node creation process. Your flash file goes there first and it allows the preview function to work. It sounds like the database didn't get updated properly as files are moved from flash/temp to just flash when you submit the node.

Q) If you look at the site via FTP is the swf file actually in the flash folder? If it is then the file was moved correctly, and the database is wrong. If the files isn't there then it means it never got moved. Either way, seems another bug has popped up!

Also, is this error occurring for every node you create, or just one/some?

Stuart Greenfield’s picture

@gdw2 - could #29 above be a reason why some mp3's failed to upload on your site? Were the problem files particularly large?

GoofyX’s picture

files/flash/temp is the "holding" area that flash node uses during the node creation process. Your flash file goes there first and it allows the preview function to work. It sounds like the database didn't get updated properly as files are moved from flash/temp to just flash when you submit the node.

Q) If you look at the site via FTP is the swf file actually in the flash folder? If it is then the file was moved correctly, and the database is wrong. If the files isn't there then it means it never got moved. Either way, seems another bug has popped up!

The file is in files/flash. It seems that the database is not updated correctly.

I created a new node (without previewing it first) and after I see the new node, I get those messages. The file is moved into files/flash, but it seems that in database its location is in temp. I temporarily solve this problem, by symlinking it from temp to ../ (files/flash).

GoofyX’s picture

Regarding comment #29, maybe you could a a type of notice in README.txt, to warn the user to check first the file upload settings in Drupal administration, in case they try to upload a big file like me and hit their head on the wall. It would surely help.

Stuart Greenfield’s picture

In response to #33 I've added a quick entry to the README.

I've never seen the error reported in #29 before. I've just committed a debug version of Flash node to HEAD. It provides messages during the insert process to track what is happening. If you could try that and paste the results that would be a big help.

From what you're saying the node is saving ok, but not viewing? And the same message four times? Really weird!

Also from what you've said the files are going to the right place (/files/flash) but the database is wrong (/files/flash/temp). The filepath should update as part of the move process, so I don't understand why the file moved but the path didn't get stored right!

For info, on the current version then when I create a new node I get:

  • Doing flashnode_insert...
  • Trying to move files/flash/temp/seans birthday.swf to flash/seans birthday.swf
  • Move was successful
  • Filename for database is flash/seans birthday.swf
  • _flashnode_insert succeeded
  • Your Flash has been created.

Thanks! And sorry flash node isn't working out easy for you!!

Stuart Greenfield’s picture

@GoofyX

Thinking about it, the files/flash/temp issue is different to the original issue raised in this thread, so I've opened a new thread here to track this issue separately. Can you post follow up to the new thread. Thanks!

Stuart Greenfield’s picture

Status: Active » Fixed

I am hoping the change to the upload check has fixed the upload error message, so setting this issue as fixed. Please re-open if not the case!

Anonymous’s picture

Status: Fixed » Closed (fixed)