Insert Image Using PHP Mysqli

   <input type="file" name="att_user_photo"  class=" validate[required] text-input"  />


<?php

include "include/connection.php";
if(isset($_POST['btn-submit']))
{
extract($_POST);
$name1=$_FILES['att_user_photo']['name'];
$size=$_FILES['att_user_photo']['size'];
$type=$_FILES['att_user_photo']['type'];

$temp=$_FILES['att_user_photo']['tmp_name'];
 move_uploaded_file($temp,"images/".$name1);





$q=mysqli_query($con,"insert into att_add_user(att_user_name,att_user_gender,att_user_mobileno,att_user_address,att_user_photo,att_user_dob,att_user_jd,att_user_ld,att_user_post,att_user_department,att_user_fe,att_user_se,att_user_te,att_user_be,att_user_email,att_user_password,att_user_cpassword) values(
'$att_user_name','$att_user_gender','$att_user_mobileno','$att_user_address','$name1','$att_user_dob','$att_user_jd','$att_user_ld','$att_user_post','$att_user_department','$att_user_fe','$att_user_se','$att_user_te','$att_user_be','$att_user_email','$att_user_password','$att_user_cpassword')") or die(mysqli_error($con));

    if($q)
    {
        echo"<script>";
        echo"alert('New User Added Successfully!');";
        echo 'window.location.href = "userinformation.php";';
        echo"</script>";
    }
    else
    {
        echo"<script>";
        echo"alert('Error While Inserting New User.');";
        echo"</script>";
    }
}
?>


Previous
Next Post »