I just noticed something really wierd.
If i upload a picture, it does go into the directory but !
it ( member_pic ) value doesn't show up in the databse ...
But if i upload a second picture...
the first ( member_pic ) value is in there but not the current one i just uploaded.
What is wrong ?
$image_max_width="155";
$image_max_height="93";
if (isset($_POST['submit'])) {
if(isset ($_FILES['picture']['name']) && $_FILES['picture']['name'] !== "")
{
$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);//line 14
$size = GetImageSize($picture);//line 16
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";
}
else
{
echo "no picture uploaded";
}
}
?>
<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>