I write an upload image script to my local server it works but when i upload online it did not but it display 0 as $_FILE['filenam']['error']
this is the code send me answer please to my email <<snip>> or reply here
$target_path='../uploads/';
$_passport_path=$_FILES['passport_file']['name'];
$_pp_type=&$_FILES['passport_file']['type'];
$_pp_size=&$_FILES['passport_file']['size'];
$_maxima_size=30000;
if(($_pp_type=='image/jpeg') ||//
($_pp_type=='image/gif') ||
($_pp_type=='image/jpg') ||
($_pp_type=='image/pjpeg') ||
($_pp_type=='image/bmp') ||
($_pp_type=='image/picture'))
{
if($_pp_size>$_maxima_size)
{
unset($_SESSION['showRegistration']);//close the registration page buy setting the session to nothing
$_SESSION['pp_upolad_report']="The maximum size of photo required should been 3KB with of 120px x 140px";
header("Location:../staff_registration.php");
}
else
{
$target_path.=rand(1000,9999).$_passport_path;//get the name of the new file
if(move_uploaded_file($_FILES['passport_file']['tmp_name'],$target_path))
{
$_file_ppname=basename($target_path);//get the name of the photo passport
$date_registered=time();
//check if the registration name is already registered if false not registered
if(is_Employment_Id_Registered($_SESSION['previous_id'])==false)//check id
{
$next_employer_id=$_REQUEST['hidenemployerid'];
$sql_pic=mysql_query("insert into staff_registration_table ".
"(photo,date_registered,employment_id)".
"values".
"('$_file_ppname','$date_registered','$next_employer_id')");
if(!$sql_pic)
{
die(mysql_error());
}
$_SESSION['previous_id']=$next_employer_id;
$_SESSION['pp_upolad_report']="Picture Has Been Successfully Upload ,Please Continue Registration";
$_SESSION['showRegistration']="true";
header("Location:../staff_registration.php");
}//end is_Employment_Id_Registered not registered
else
{//if the id has been already registered then update the id
$next_employer_id=$_SESSION['previous_id'];
$sql_pic=mysql_query("update tbl_student_registration set photo='$_file_ppname',date_registered='$date_registered',employment_id='$next_employer_id' where employment_id='$next_employer_id' ");
$_SESSION['previous_id']=$next_employer_id;
$_SESSION['pp_upolad_report']="Picture Has Been Successfully Upload ,Please Continue Registration";
$_SESSION['showRegistration']="true";
unlink("../uploads/".$_SESSION['file_ppname']);
header("Location:../staff_registration.php");
}//end is_Employment_Id_Registered yes registered
$_SESSION['file_ppname']=$_file_ppname;
}//end if move passport
else
{
//return an display error
unset($_SESSION['showRegistration']);//close the registration page buy setting the session to nothing
$_SESSION['pp_upolad_report']="Picture upload error is ".$_FILES['passport_file']['error'];
header("Location:../staff_registration.php");
}
}//end else of size
}//end if to check photo type
else
{
unset($_SESSION['showRegistration']);//close the registration page buy setting the session to nothing
$_SESSION['pp_upolad_report']="Sorry wrong passport format $_pp_type (used format like .jpeg,.png,.gif) and make sure the size is not more than 6kb";
header("Location:../staff_registration.php");
}