hello guyes ..i dont know what is the problem with this code ..it was working with me before but now it just store nothing ...

when i submite the data every thing shows in the database ecept that image nothing shows there ..i attached the code here so every can view it and help me to solve it...

Thanks In advance..

<?
global $strDesc;

global $fileUpload;

global $fileUpload_name;

global $fileUpload_size;

global $fileUpload_type;

include("db_conn.php");

//this is famaily section
$mother_name=$_POST['mother_name'];
$mother_occupation=$_POST['mother_occupation'];
$father_name=$_POST['father_name'];
$father_occupation=$_POST['father_occupation'];
$address=$_POST['address'];
$home_number=$_POST['home_number'];
$mobile_number=$_POST['mobile_number'];
$best_contact_number=$_POST['best_contact_number'];
$email=$_POST['email'];
$country_of_origin=$_POST['country_of_origin'];
$cast=$_POST['cast'];
$religious_interest=$_POST['religious_interest'];
$language_spoken=$_POST['language_spoken'];

//this is applicant section

$full_name=$_POST['full_name'];
$age=$_POST['age'];
$dob=$_POST['dob'];
$hight=$_POST['hight'];
$status=$_POST['status'];
$children=$_POST['children'];
$how_many=$_POST['how_many'];
$complexion=$_POST['complexion'];
$smoker=$_POST['smoker'];
$language_spoken_app=$_POST['language_spoken_app'];
$education=$_POST['education'];
$occupation=$_POST['occupation'];
$hobbies_interests=$_POST['hobbies_interests'];
$key_attributes=$_POST['key_attributes'];
$accommodation=$_POST['accommodation'];
$criminal_record=$_POST['criminal_record'];

$uploaddir = '/app_pics/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
copy($_FILES['userfile']['tmp_name'], $uploadfile);
$link=$uploadfile;

$query=mysql_query("INSERT INTO `form_data` 
(mother_name,mother_occupation,father_name,father_occupation,address,home_number
,mobile_number,best_contact_number,email,country_of_origin,cast,religious_interest
,language_spoken,full_name,age,dob,hight,status,children,how_many,complexion,smoker
,language_spoken_app,education,occupation,hobbies_interests,key_attributes,accommodation
,criminal_record,app_pics)
".
"VALUES

('$mother_name','$mother_occupation','$father_name','$father_occupation','$address','$home_number'
,'$mobile_number','$best_contact_number','$email','$country_of_origin','$cast','$religious_interest','$language_spoken','$full_name','$age','$dob','$hight','$status','$children','$how_many','$complexion','$smoker','$language_spoken_app','$education','$occupation','$hobbies_interests','$key_attributes','$accommodation','$criminal_record','$link')");
mysql_close();

//echo("<script language='JavaScript'>");
//echo("window.location='index.html';");


?>

Recommended Answers

All 8 Replies

Is the image path actually saved to the database? Or is it blank?

Is the image actually being copied to the directory /app_pics/ ?

nothing is copied in the directory but when i view the database save the name of the directory only but nothing is copied in the directory ....

when we save any image in database thats actually means that we are saving the image name in database and uploading image some where at our server. your image name is storing in database? or ur image is properly uploading in your defined place?

will i an trying that way to store the path of the image and upload it in to specific folder on my server but the problem nothing is storing in the folder at the server ..but when i view the database it shows me that it store the folder name which is /app_pics/
thanks

ok first check ur folder permissions in which you are loading the images. it should be 775 or 777 .then you can write any file in the folder. and check your image name is in you code,why its not appearing?
r u using this form property as well?

enctype="multipart/form-data"

try the changes that i hv done

hello guyes ..i dont know what is the problem with this code ..it was working with me before but now it just store nothing ...

when i submite the data every thing shows in the database ecept that image nothing shows there ..i attached the code here so every can view it and help me to solve it...

Thanks In advance..

<?
global $strDesc;

global $fileUpload;

global $fileUpload_name;

global $fileUpload_size;

global $fileUpload_type;

include("db_conn.php");

//this is famaily section
$mother_name=$_POST['mother_name'];
$mother_occupation=$_POST['mother_occupation'];
$father_name=$_POST['father_name'];
$father_occupation=$_POST['father_occupation'];
$address=$_POST['address'];
$home_number=$_POST['home_number'];
$mobile_number=$_POST['mobile_number'];
$best_contact_number=$_POST['best_contact_number'];
$email=$_POST['email'];
$country_of_origin=$_POST['country_of_origin'];
$cast=$_POST['cast'];
$religious_interest=$_POST['religious_interest'];
$language_spoken=$_POST['language_spoken'];

//this is applicant section

$full_name=$_POST['full_name'];
$age=$_POST['age'];
$dob=$_POST['dob'];
$hight=$_POST['hight'];
$status=$_POST['status'];
$children=$_POST['children'];
$how_many=$_POST['how_many'];
$complexion=$_POST['complexion'];
$smoker=$_POST['smoker'];
$language_spoken_app=$_POST['language_spoken_app'];
$education=$_POST['education'];
$occupation=$_POST['occupation'];
$hobbies_interests=$_POST['hobbies_interests'];
$key_attributes=$_POST['key_attributes'];
$accommodation=$_POST['accommodation'];
$criminal_record=$_POST['criminal_record'];

$uploaddir = '/app_pics/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
copy($_FILES['userfile']['tmp_name'], $uploadfile);
//replace your code with this and try
$uploaddir = '/app_pics/';
			$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
			move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);

$link=$uploadfile;

$query=mysql_query("INSERT INTO `form_data` 
(mother_name,mother_occupation,father_name,father_occupation,address,home_number
,mobile_number,best_contact_number,email,country_of_origin,cast,religious_interest
,language_spoken,full_name,age,dob,hight,status,children,how_many,complexion,smoker
,language_spoken_app,education,occupation,hobbies_interests,key_attributes,accommodation
,criminal_record,app_pics)
".
"VALUES

('$mother_name','$mother_occupation','$father_name','$father_occupation','$address','$home_number'
,'$mobile_number','$best_contact_number','$email','$country_of_origin','$cast','$religious_interest','$language_spoken','$full_name','$age','$dob','$hight','$status','$children','$how_many','$complexion','$smoker','$language_spoken_app','$education','$occupation','$hobbies_interests','$key_attributes','$accommodation','$criminal_record','$link')");
mysql_close();

//echo("<script language='JavaScript'>");
//echo("window.location='index.html';");


?>

BzzBee i am realy thanks full to for ur helpe but the problem still the same and no i am not using

enctype="multipart/form-data"

i am trying this on my local PC how i can change the folder permissions?

thanks

BzzBee i am realy thanks full to for ur helpe but the problem still the same and no i am not using

i am trying this on my local PC how i can change the folder permissions?

thanks

It is good to view the actual variables in your PHP script.

var_dump($_POST, $_FILES);

Right at the top to see the contents of $_POST and $_FILES.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.