I am unable to see any image uploaded in the target folder. I also tried if (move_uploaded_file($HTTP_POST_FILES['memphoto']['tmp_name'], $target.$HTTP_POST_FILES['memphoto']['name'])) instead of if(copy($_FILES['photo']['tmp_name'], $uploadimages)) but didn't get any result. Can anybody help me.
<?php
if ((isset($_FILES['photo']) && ($_FILES['photo']['size'] > 0))
{
$typ = $_FILES['photo']['type'];
if($typ == "image/gif" || $typ == "image/png" || $typ == "image/jpeg" || $typ == "image/pgif" || $typ == "image/ppng" || $typ =="image/pjpeg" || $typ =="image/jpg")
{
$uploaddir = "images/";
$uploadimages = $uploaddir.basename($_FILES['photo']['name']);
if(copy($_FILES['photo']['tmp_name'], $uploadimages))
{
echo "File successfully copied";
$query = "UPDATE $tbl_name SET photo='$uploadimages WHERE ID='$ID' ";
if (!mysql_query($query))
{
die('Error: ' . mysql_error());
mysql_close();
}
}
else{echo "Copy unsuccessful";}
}
else{
echo "Incorrect file type";
}
}
else {
echo "No Photo/Signature file selected/uploaded.";
}
?>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…