I have the form below, works fine but just problem i am not understanding how to fix problem.
I get these 2 errors if i just go to the page and do not upload anything, all i do is just click on submit to get the error !!
I know it has something to do with the fact i didnt upload a picture.
Errors :
Warning: Unable to access in /home/www/html/picture.php on line 14
Warning: getimagesize: Unable to open '' for reading. in /home/www/html/picture.php on line 16
Below is the code
$image_max_width="155";
$image_max_height="93";
if ($submit) {
$query = "UPDATE trial SET member_pic = '$member_pic' WHERE user_id = '$user_id'";
$result = mysql_query($query) or die( "ERROR: " . mysql_error() . "\n");
copy($picture, "/home/www/html/images/" . $picture_name);[COLOR=orange]//line 14[/COLOR]
$size = GetImageSize($picture);[COLOR=orange]//line 16[/COLOR]
if ($size[0] > $image_max_width) {
echo "Your image should be no wider than " . $image_max_width . " Pixels<br><a href=\"memberpic.php\">Go Back</a>\n";
exit;
}
if ($size[1] > $image_max_height) {
echo "Your image should be no higher than " . $image_max_height . " Pixels<br><a href=\"memberpic.php\">Go Back</a>\n";
exit;
}
echo "<br>File uploaded successfully<br>";
echo "file name: $picture_name<br>\n";
echo "temp file: $picture<br>\n";
echo "file size: $picture_size<br>\n";
echo "file type: $picture_type<br>\n";
echo "<br>\n";
echo "<img src=../eimages/$picture_name><br>\n";
}
?>
<form enctype="multipart/form-data" method="post" action="<?php echo $PHP_SELF ?>">
<br>
<input type="hidden" name="member_pic" size="25" value="eimages/<?php echo $picture_name; ?>">
<input type="hidden" name="$user_id" value="<?php echo $user_id; ?>">
<br>
picture
<br>
<br>
<input type="File" name="picture" size="25">
<br><br>
<input type="submit" name="submit" value="Upload">
</form>
[/PHp]