Image uploading problem
Posted: Sat Apr 12, 2008 12:34 am
Hi,
I can't upload image to my Global Server but the code works fine in local server. Please solve it. My code is written bellow...
Code :
***** PLEASE USE THE CODE OR PHP TAGS WHEN POSTING *****
I can't upload image to my Global Server but the code works fine in local server. Please solve it. My code is written bellow...
Code :
***** PLEASE USE THE CODE OR PHP TAGS WHEN POSTING *****
Code: Select all
if(isset($_REQUEST['insert'])){
$p_name=$_REQUEST['p_name'];
$p_price=$_REQUEST['p_price'];
$desc=$_REQUEST['desc'];
$insdate=date('Y-m-d');
$i=date('Y-m-d h-m-s');
$sorce=$_FILES['p_image']['tmp_name'];
$des=$_FILES['p_image']['name'];
$im=$i.$des;
if(file_exists("Image/".$im)){
unlink("Image/".$im);
}
copy($sorce,"Image/".$im) or die ("Could not copy");
$sql_s="INSERT INTO product (p_name,p_desc,p_price,p_image,adddate) VALUES('".$p_name."','".$desc."','".$p_price."','".$im."','".$insdate."')";
if($res_s=mysql_query($sql_s)){
$msg="insert successfully";
}else{
$msg="Try again";
}
}