Wednesday, June 16, 2010

Symfony 1.4 uploads FLV as EXE or BIN files

When transferring a project from our development server to our production server at work, I realized that uploading FLV files resulted in the end result being a .BIN (or binary file). Oddly this didn't happen on the development server, only the production server. After verifying everything I could think of between the two servers, I finally decided on a solution.

Problem: 
Symfony uploading FLV files as BIN files (or sometimes EXE on Windows).

More Information:
Symfony has a big associated array of mime-types and file extensions, one that specifies 'application/octet-stream' as being associated with the file type BIN.

Solution:
I tried manually changing the sfValidatedFile.class.php file in lib/vendor/symfony/lib/validator/ but it didn't help. To solve this problem, I ended up manually checking the file's extension before and after upload and then correcting it if it was wrong. If I come up with a better solution, I will definitely post my findings.

Good luck.

2 comments:

Anonymous said...

did you open some ticket?

Michael Corrigan said...

I believe I did open a ticket for this issue.