I\'ve heard that the best way to handle uploaded images is to \"re-process\" them using the GD library and save the processed image. see: PHP image upload secu
GD
function isvalidjpeg($file) { $finfo = finfo_open(FILEINFO_MIME_TYPE); return is_resource($finfo) && (finfo_file($finfo, $file) === 'image/jpeg') && finfo_close($finfo); } if(isvalidjpeg($_FILES['file']['tmp_name'])) { $newIm = @imagecreatefromjpeg($_FILES['file']['tmp_name']); .....