The Problem
I recently came across a problem where I was unable to upload one particular SWF file even though I've done it before with no problems and I confirmed that the SWF file type was still in my settings.
The Cause
A little research little and I found out that there are some SWF file that are really SWC files but they have an extension of SWF. They have the wrong extension so that they'll play in your browser's flash viewer as normal. Depending upon what site you go to SWC files are defined as being either component files or compressed files but, when they have an SWF extension, they behave like any other SWF file would.
Now where it get's interesting is that the Gallery is smart enough to know if somebody is trying to upload a file with the wrong extension! That's a very useful thing to have in there but when uploading these SWC files that have an SWF extension the Gallery will return an "Invalid File Type" error with no further explanation.
The Hacked Solution
Where it associated the file extension (type) to a numeric value is at the bottom of gallery_global.php but I didn't want to mess with anything there because having it know "swf" and "swc" uniquely might be useful someday in the future.
Where it checks the file's extension versus it's actual file type is in the functions_gallery_imageedit.php file (around line 405).
Look for this code:
Code:
Content visible to verified customers only.
... and replace it with this:
Code:
Content visible to verified customers only.
... and that will take care of the problem for now. What the change does is look for the numerical value assigned to the file type (in this case, "13" for SWC files) and then let's it bypass the error check if the extension is either SWC or SWF. I'm sure Brian & Zach' can offer a cleaner version to take care of it but if you need an interim solution that'll do it.
NOTE: Two things... (1) Before uploading SWF files you'll need to add an entry for SWF in your Gallery settings! (2) If you aren't working with SWF files and if you aren't experiencing any problems then this doesn't apply so there is no point in modifying your code if you don't have to.