If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > PHP > how to store images in mysql using php?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-16-09, 19:11
khubaib.php khubaib.php is offline
Registered User
 
Join Date: Mar 2007
Posts: 3
how to store images in mysql using php?

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..

PHP Code:

<?
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';");


?>
Reply With Quote
  #2 (permalink)  
Old 08-17-09, 05:22
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
You should be using the PHP function move_uploaded_file() instead of copy()
Reply With Quote
  #3 (permalink)  
Old 08-17-09, 06:24
khubaib.php khubaib.php is offline
Registered User
 
Join Date: Mar 2007
Posts: 3
i trayed that tooo ...same thing it is just store the folder name in the database not the full path and nothing is copied in the folder...

thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On