how to view an image to the upload directory?
i am using this <img src=$row[image]> correct me if im wrong here…
below is my php code for my upload.php but the problem is how to view the image?
hope anyone can help me..
[code=php]
<?php
if (array_key_exists(‘_submit_check’, $_POST)){
$max_image_width= 380;
$max_image_height= 600;
$max_image_size= 64 * 1024;
$image_type = array(“gif”,”jpg”, “jpeg”);
if (isset($_FILES[“userfile”])) {
if (is_uploaded_file($_FILES[“userfile”][“tmp_name”])) {
$image_name = $_FILES[“userfile”][“tmp_name”];
$ext = substr($_FILES[“userfile”][“name”],
1 + strrpos($_FILES[“userfile”][“name”], “.”));
if (filesize($image_name) > $max_image_size) {
$error = “Error: File size > 64K.”;
} elseif (!in_array($ext, $image_type)) {
$error = “Error: Invalid file type.”;
} else {
$image_size = GetImageSize($image_name);
if (($image_size) && ($image_size[0] < $max_image_width) && ($image_size[1] < $max_image_height)) {
$uploaddir = “/home/simply22/public_html/admin/cj/”;
if (move_uploaded_file($_FILES[“userfile”][“tmp_name”], $uploaddir .
$_FILES[“userfile”][“name”]))
{
$msg = “The file has been uploaded, and your information has been added to the directory”;
} else {
$error = “Error: moving fie failed.”;
}
} else {
$error = “Error: invalid image properties.”;
}
}
} else {
$error = “Error: empty file.”;
}
$couponstore=$_POST[‘couponstore’];
$coupontitle=$_POST[‘coupontitle’];
$website=$_POST[‘website’];
$userfile=$_FILES[‘image’];
$image_name=$_POST[‘image_name’];
$image_type=$_POST[‘image_type’];
$image_size=$_POST[‘image_size’];
$detail=$_POST[‘detail’];
$days=$_POST[“days”];
$date=$_POST[‘date’];
$feat=$_POST[‘feat’];
$sto_cat=$_POST[‘sto_cat’];
$sql=”INSERT INTO deals (couponstore, coupontitle, image, image_name, image_type, image_size, website, detail, days, date, feat, sto_cat) values(‘$couponstore’, ‘$coupontitle’, ‘$userfile’, ‘$image_name’, ‘$image_type’, ‘$image_size’,’$website’, ‘$detail’, ‘$days’, ‘$date’, ‘$feat’, ‘$sto_cat’)”;
$result=mysql_query($sql,$dbh) or die(mysql_error());
}
}
?>