I have written a script that uploads an image to a directory and the name of the image in a database.
my problem is that I can not get the image to display on a browser, can someone please help.
my code is as followed.
THIS IS MY FORM SCRIPT:
<?
// Name this file as upload.php
print ("<form name='x' enctype='multipart/form-data' method='post' action='uploadresp.php'>"
;
print ("<table border=1 align=center>"
;
print ("<tr>"
;
print ("<td><font face='OCR A Extended'><b>Simple Image Upload</b></td>"
;
print ("</tr>"
;
print ("<tr>"
;
print ("<td><font face='OCR A Extended'>Select Image</font></td><td><input type='file' name='myimage'></td>"
;
print ("</tr>"
;
print ("<tr>"
;
print ("<td></td><td><input type='submit' value=upload></td>"
;
print ("</tr>"
;
print ("</table>"
;
print ("</font>"
;
print ("</form>"
;
?>
THIS IS MY UPLOAD SCRIPT:
<?
$uploaddir = "images/";
$username = "Max";
$email = "cyber@corporatestreet.net";
$mailsubject="Image Uploaded";
$mailsubject2="Image Upload Failed";
$Fromname="Max";
$Fromaddress="Max";
$server="localhost/";
//Upload 2 Image -------------------------------------
$db = mysql_connect("***", "***","***"
;
mysql_select_db("testdb",$db);
$sql = "INSERT INTO images2 (img_file) VALUES ('$myimage_name')";
$result = mysql_query($sql);
if(!empty($myimage_name))
{
if(copy($myimage,$uploaddir.$myimage_name));
{
$msg="Hi Max, the $myimage_name is Uploaded into $uploaddir Directory";
print ($msg);
if (mail($username." <".$email.">", $mailsubject, $msg, "From: ".$Fromname." <".$Fromaddress.">\nContent-Type: text/html; charset=iso-8859-1"
)
{
print "<br>";
print ("Confirmation Mail Sent "
;
}
else
{
print ("Mail Could not be Delivered"
;
}
}
}
else
{
$msg="Hi Max, Something Went Wrong Image did not Get Uploaded , please use chmod777 to upload directory";
print ($msg);
if (mail($username." <".$email.">", $mailsubject2, $msg, "From: ".$Fromname." <".$Fromaddress.">\nContent-Type: text/html; charset=iso-8859-1"
)
{
echo "<br>";
print ("Confirmation Mail Sent "
;
}
else
{
print ("Mail Could not be Delivered"
;
}
}
?>
MY PROBLEM IS THAT I CAN'T GET THE IMAGE TO DISPLAY ON A BROWSER. I HAVE TRIED TO WRITE A SCRIPT FOR DISPLAYING THE IMAGE BUT I HAVE NO LUCK, I WOULD LIKE TO DISPLAY THE IMAGE BY WAY OF THE ID SO THAT I CAN COMBINE THE IMAGE WITH ARTICLE.
CAN SOMEONE PLEASE HELP WITH THIS PART.
I APPRECIATE YOU IN ADVANCE.
CYBER
my problem is that I can not get the image to display on a browser, can someone please help.
my code is as followed.
THIS IS MY FORM SCRIPT:
<?
// Name this file as upload.php
print ("<form name='x' enctype='multipart/form-data' method='post' action='uploadresp.php'>"

print ("<table border=1 align=center>"

print ("<tr>"

print ("<td><font face='OCR A Extended'><b>Simple Image Upload</b></td>"

print ("</tr>"

print ("<tr>"

print ("<td><font face='OCR A Extended'>Select Image</font></td><td><input type='file' name='myimage'></td>"

print ("</tr>"

print ("<tr>"

print ("<td></td><td><input type='submit' value=upload></td>"

print ("</tr>"

print ("</table>"

print ("</font>"

print ("</form>"

?>
THIS IS MY UPLOAD SCRIPT:
<?
$uploaddir = "images/";
$username = "Max";
$email = "cyber@corporatestreet.net";
$mailsubject="Image Uploaded";
$mailsubject2="Image Upload Failed";
$Fromname="Max";
$Fromaddress="Max";
$server="localhost/";
//Upload 2 Image -------------------------------------
$db = mysql_connect("***", "***","***"

mysql_select_db("testdb",$db);
$sql = "INSERT INTO images2 (img_file) VALUES ('$myimage_name')";
$result = mysql_query($sql);
if(!empty($myimage_name))
{
if(copy($myimage,$uploaddir.$myimage_name));
{
$msg="Hi Max, the $myimage_name is Uploaded into $uploaddir Directory";
print ($msg);
if (mail($username." <".$email.">", $mailsubject, $msg, "From: ".$Fromname." <".$Fromaddress.">\nContent-Type: text/html; charset=iso-8859-1"

{
print "<br>";
print ("Confirmation Mail Sent "

}
else
{
print ("Mail Could not be Delivered"

}
}
}
else
{
$msg="Hi Max, Something Went Wrong Image did not Get Uploaded , please use chmod777 to upload directory";
print ($msg);
if (mail($username." <".$email.">", $mailsubject2, $msg, "From: ".$Fromname." <".$Fromaddress.">\nContent-Type: text/html; charset=iso-8859-1"

{
echo "<br>";
print ("Confirmation Mail Sent "

}
else
{
print ("Mail Could not be Delivered"

}
}
?>
MY PROBLEM IS THAT I CAN'T GET THE IMAGE TO DISPLAY ON A BROWSER. I HAVE TRIED TO WRITE A SCRIPT FOR DISPLAYING THE IMAGE BUT I HAVE NO LUCK, I WOULD LIKE TO DISPLAY THE IMAGE BY WAY OF THE ID SO THAT I CAN COMBINE THE IMAGE WITH ARTICLE.
CAN SOMEONE PLEASE HELP WITH THIS PART.
I APPRECIATE YOU IN ADVANCE.
CYBER