Possible Duplicate:
How to check if an uploaded file is an image without mime type?
uploading, processing, storing and delivering user-provided files and images
i have image sharing script, i made half of it. the user can rename any php or cgi file to .jpg and upload it and it upload succfully
How to prevent uploading such fake images?
here is my way to check the file type
$userfile_type = $_FILES['file']['type'];
and when i rename php file to php.jpg it can be uploaded easly.