How to limit the uploaded image dimensions?
Posted: Mon May 29, 2006 4:17 pm
I have the following code to upload image.
Is there an easy way to limit the image dimensions ( and/or file type since i had to hardcode it here to jpg)
thanks!
Is there an easy way to limit the image dimensions ( and/or file type since i had to hardcode it here to jpg)
Code: Select all
$action = $_POST["action"];
$max_size = "102400";
if ($action == 'upload')
{
if ($_FILES["filename"]["size"] > $max_size) die ("<b>File too big! Try again...</b>");
$uname= $_POST['Username'];
copy($_FILES["filename"]["tmp_name"],"images/userlogo/$uname".$_FILES["filename"][''].'.jpg') or die(mysql_error());
}