I'm trying to upload a picture to a directory and the code below returns the following error:
Warning: getimagesize: Unable to open '' for reading. in /home/httpd/vhosts/greenfork.com/httpdocs/uploadpic.php on line 7
Can someone point me in the right direction to get this corrected? THank you
form page
<FORM ENCTYPE="multipart/form-data" ACTION="uploadpic.php" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="500000">
<B>Change profile photo:</B><BR><BR><INPUT NAME="uploadedfile" TYPE="file"><BR>
<font size=-2>(Only .gif & .jpg files, under 25K and under 250px X 300px accepted)</font><BR><BR>
<input type=image src="/images/go.gif" align=right>
</FORM>
add image code
$HW = getimagesize($uploadedfile);
$width = $HW[0];
$height = $HW[1];
echo "<BR>";
if(empty($uploadedfile))
{
error_display("Please choose a file to upload.", "manager.php");
}
else
{
if($uploadedfile_size <= 55000)
{
if ($uploadedfile_type == 'image/gif' | $uploadedfile_type == 'image/pjpeg')
{
if($width > 250 | $height > 300)
{
error_display("<BR>The height and/or width of the image is too large.<BR><BR>The height and width of your image are $height pixels and $width pixels respectfully.<BR><BR>Please make certain your image is less than 300 pixels in height and 250 pixels in width.", "manager.php");
}
else
{
move_uploaded_file($uploadedfile, "C:\INETPUB\WWWROOT\DINING\USERS\$user\mypic.gif");
redirect_user2("manager.php?u=f");
}
echo "<BR>";
}
else
{
error_display("Only <B>.gif</b> and <b>.jpg</b> files are allowed to be uploaded.", "manager.php");
}
}
else
{
error_display("File size is too large. Your image had a file size of <font color=red><b>$uploadedfile_size</b></font> and it needs to be <b>under 55,000</b>.", "manager.php");
}
}