Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2007
    Posts
    3

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


    ?>

  2. #2
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    You should be using the PHP function move_uploaded_file() instead of copy()

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •