checking file type on upload

From: Date: Mon, 20 Dec 2004 18:00:57 +0000
Subject: checking file type on upload
Groups: php.general 
Request: Send a blank email to php-general+get-204735@lists.php.net to get a copy of this message
i have an upload form which i would only like to allow compressed zip files and rar files to be uploaded. currently i use if ($_FILES['userfile']['type'] != 'application/x-zip-compressed') which only seems to work in IE, doesn't work in mozila (haven't tried others) what the best way to detect if its a rar or zip file which works in a better range of browsers? someone gave me a suggestion to check if the file ends in .rar or .zip but that isn't very secure since anyone would be able to append it to the filename regardless of the actual file type. thanks.

« previous php.general (#204735) next »