PHP Upload File Verification

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rbc
Forum Newbie
Posts: 22
Joined: Tue Sep 02, 2008 6:00 pm

PHP Upload File Verification

Post by rbc »

I've been going round and round with a php upload application I'm working on. I have setup a MIME TYPE check to allow for certain file types to be permitted to be uploaded. However, I'm running into serious issues with .WMV files and have read that this might not be the best way to check files prior to uploading them as there are ways to hack around this type of check. If this is true is there a better way to check file types in this situation? What are they and can you give me some guidance or direction for this?

Thanks
Brian
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: PHP Upload File Verification

Post by Jade »

You could always check the extension on the file using javascript. Otherwise there's no way to check the file information before you've sent some kind of request to the server since PHP is a server side programming language.
rbc
Forum Newbie
Posts: 22
Joined: Tue Sep 02, 2008 6:00 pm

Re: PHP Upload File Verification

Post by rbc »

Couldn't they still hack around this the same as the could with a PHP MIME TYPE check?
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: PHP Upload File Verification

Post by Jade »

When all is said and done it's not terribly difficult to do that with any kind of file. I'm not sure there is a fool-proof way to do it, but then again file systems aren't my specialty -- games are. Maybe someone else knows.
Post Reply