Search code examples
phpfilesymfonymime-typeswmv

Symfony2 MimeTypeGuesser handling WMV files incorrectly


Update: This is code that handles uploading of video files.

I have a symfony2 project which has 3x MIME type guessers registered at run-time. They are:

[0] => Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser Object
[1] => Symfony\Component\HttpFoundation\File\MimeType\ContentTypeMimeTypeGuesser Object
[2] => Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser Object

When FileBinaryMimeTypeGuesser.php executes, the method guess() gets called, which does:

file -b --mime video.wmv 2>/dev/null

And the result is:

application/octet-stream; charset=binary

Which is incorrect - Per microsoft, wmv should have a MIME type of:

audio/x-ms-wmv

Any idea why this is not working?


Solution

  • So, it appears it has something to do w/the videos. Some videos I've found on the internet work while others do not. I'm not sure why, as they are all wmv's - Anyways, this doesn't appear like an issue w/the guesser, but an issue w/the encoding properties or byte sequence of some wmvs.

    Yahhh microsoft!