I am writting a script to allow uploading of certain files. I want to limit the files by their filename and mime type, and by making sure the two match up.
The first thing I need to do is make sure I've got all the mime types I need added. I have never done this before, but I understand that 'file' (which is what PHP's mime-type finding is based off of) uses magic databases that tell at which point in the file should have signatures of the filetype.
My trouble started when I was unable to determine the filetype of any of my video files. Currently, I have some .MOV and .MP4 files that I am using to test.
I noticed a very generic listing for the file, so I tried researching how to add the files myself. After reading tons of useless pages, I came across a program called assoGiate (available in the repos). It is a GUI based tool to add/edit/remove mime types. I was unable to add a custom MP4 mime-type because it already existed and after checking my file with gHex, I realized that my file does indeed contain the information needed to flag it as MP4...Code:file --mime VID00003.MP4 VID00003.MP4: application/octet-stream; charset=binary
My file
Third entry for MP4'sCode:....ftypMSNV.).FM
So, now, I am just really confused about all of this.Code:type: string priority: 50 value: ftypMSNV Offset: 4
Since this was already in my System DB, I haven't needed to, but have indeed run # update-mime-database /usr/share/misc/magic
Any help or leads will be greatly appreciated.
Thanks![]()



Adv Reply

Bookmarks