Hi There,
I am newbie in php, and having problem with uploading image in php and I have to edit someone’s code so its little complicated.
Please have a look
if ($HTTP_POST_FILES['enlarge3']['name'] != "") {
$photo_name = post_img($HTTP_POST_FILES['enlarge3']['name'], $HTTP_POST_FILES['enlarge3']['tmp_name'],"../userimages");
$sql = "insert into tbl_photo(userid,photo) values('$userid','$photo_name')";
$imgRes = Execute($sql);
}
What I think is, $HTTP_POST_FILES is not supported in my local host, Is there something I need to do it as It working perfectly when I am trying this.
$spth = "../userimages/".$_FILES['enlarge1']['name'];
if(copy($_FILES['enlarge1']['tmp_name'],$spth))
{
$photo_name = "../userimages".$_FILES['enlarge1']['name'];
$photo_name1 = $_FILES['enlarge1']['name'];
$sql = "insert into tbl_photo(userid,photo) values('$userid','$photo_name')";
$imgRes = Execute($sql);
}
else
{
echo 'Error: cant upload';
die;
}
thanks for your help.