$uploaddir = 'Uploads/'; $basename = basename($_FILES['userfile']['name']); $uploadfile = $uploaddir . basename($_FILES['userfile']['name']); if (!function_exists('mime_content_type')) { function mime_content_type($f) { $f = escapeshellarg($f); return trim( `file -bi $f` ); } }
if(mime_content_type($uploadfile)=="image/jpeg")
{
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
{
$_SESSION['UPLOAD_STRING'] = "\"".$basename."\""." is a valid file type and was successfully uploaded.";
}
else if(strlen($basename)<1)
{
$_SESSION['UPLOAD_STRING'] = "No file specified, please try again";
}
}
else $_SESSION['UPLOAD_STRING'] = "File extension not supported, please make sure you use a valid extension.";
Cheers, Rory.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php