PDA

View Full Version : check file width PLEASE!! :)



dentricrio
June 6th, 2007, 08:21 PM
Hi im trying to check the width of a file being upload to the file i then want it to display the error if its more than 150px but i cant get it to work, PLEASE PLEASE can some one help me with it. heres the code so far:


(list($width) = getimagesize($HTTP_POST_FILES['img1']));
if ($width < 151 AND !isset($error));{
$error = "$width<b>Error: File must be 150x150px or below. </b><br><br>";
unlink($HTTP_POST_FILES['img1']['tmp_name']);

}

eirche
June 6th, 2007, 08:36 PM
im not familiar with file upload, but since you use $HTTP_POST_FILES['img1']['tmp_name'], shouldn't $HTTP_POST_FILES['img1'] be an array? and you pass an array into getimagesize()?

dentricrio
June 7th, 2007, 08:11 AM
yeah it should be i was trying to do something different.

eirche
June 7th, 2007, 08:34 AM
yeah it should be i was trying to do something different.

what? should be? getimagesize(string filename)

use getimagesize($_FILES['img1']['tmp_name'])