Hi there, Ive constructed myself an PHP Image upload script, and due to few `complaints` about security, I've come here to seek some advice. Could anyone give me any hints on how to improve the security of a basic upload system? Thanks in advance, Obulus
One of the most important things is to check the uploaded files' MIME types. Make sure your user upload images, not some malicious scripts or something like that.
also make sure to explode the name at its first . (period) if not they could get an image such as name.php.jpg or name.php.png which are both executable http://www.w3schools.com/PHP/php_file_upload.asp
The MIME type should take care of that. If they upload a file entitled name.php.png, it will still have a MIME of a PHP and not an image. Checking the MIME type is the best bet.
it will still get past as it looks at the ending characters. just had the same problem with a clients script.