Image not uploadng............................

images php coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
meerakarthik

Image not uploadng............................

Post by meerakarthik » Wed Feb 09, 2011 5:51 am

image is not uploading......................code is here
<?php include("connect.php"); ?>
<?php

$fname = trim($_POST['fname']);
$lname = trim($_POST['lname']);
$gender = trim($_POST['gender']);
$phone = trim($_POST['txtPhone']);
$email = trim($_POST['mail']);
$location = trim($_POST['location']);
$zipcode = trim($_POST['zip']);
if(isset ($_FILES['image']) && $_FILES['size'] > 0){

$tmpName = $_FILES['image']['tmp_name'];
$fb = fopen($tmpName,'r');
$data = fread($fb,filesize($tmpName));
$data = addslashes($data);
fclose($data);
}
else
{
echo'choose ur image';
}

$query = "INSERT INTO socialdb(fname,lname,gender,dob,phone,email,location,zipcode,image)VALUES('$fname','$lname','$gender','$dob','$phone','$email','$location','$zipcode','$data')";
$results=mysql_query($query,$link);
if($result)
{
echo "Registered Successfully";
}

?>

pickyj
New php-forum User
New php-forum User
Posts: 20
Joined: Sat Feb 05, 2011 10:50 am
Location: /home/blackhatdbl
Contact:

Re: Image not uploadng............................

Post by pickyj » Wed Feb 09, 2011 10:04 am

Code: Select all

$query = "INSERT INTO socialdb(fname,lname,gender,dob,phone,email,location,zipcode,image) VALUES('".$fname."','".$lname."','".$gender."','".$dob."','".$phone."','".$email."','".$location."','".$zipcode."','".$data."')";
try this...
also, remove the second parameter of mysql_query()
NOTE: try the

Code: Select all

[ /code]

meerakarthik

Re: Image not uploadng............................

Post by meerakarthik » Wed Feb 09, 2011 8:25 pm

thanks 4 ur reply...............
but still its not working..............

meerakarthik

Re: Image not uploadng............................

Post by meerakarthik » Wed Feb 09, 2011 8:57 pm

its working with this code
==================================

Code: Select all

$fname = trim($_POST['fname']);
$lname = trim($_POST['lname']);
$gender = trim($_POST['gender']);
$phone = trim($_POST['txtPhone']);
$email = trim($_POST['mail']);
$location = trim($_POST['location']);
$zipcode = trim($_POST['zip']);
if (isset($_FILES['image']) && $_FILES['image']['size'] > 0) { 

      
      $tmpName  = $_FILES['image']['tmp_name'];  
       
      // Read the file 
      $fp      = fopen($tmpName, 'r');
      $data = fread($fp, filesize($tmpName));
      $data = addslashes($data);
      fclose($fp);
      

      // Create the query and insert
      // into our database.
     /* $query = "INSERT INTO socialdb ";
      $query .= "(image) VALUES ('$data')";
      $results = mysql_query($query, $link);
      */
      // Print results
      
      
}
else {
  
}

   
 $query = "INSERT INTO socialdb(fname,lname,gender,dob,phone,email,location,zipcode,image)VALUES('$fname','$lname','$gender','$dob','$phone','$email','$location','$zipcode','$data')";
 $results=mysql_query($query,$link);

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests