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

images php coding issues or problems here.

Moderators: macek, egami, gesf

meerakarthik
New php-forum User
New php-forum User
Posts: 5
Joined: Wed Feb 09, 2011 5:33 am

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

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

Postby 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 ][ /code]

meerakarthik
New php-forum User
New php-forum User
Posts: 5
Joined: Wed Feb 09, 2011 5:33 am

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

Postby meerakarthik » Wed Feb 09, 2011 8:25 pm

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

meerakarthik
New php-forum User
New php-forum User
Posts: 5
Joined: Wed Feb 09, 2011 5:33 am

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

Postby 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);


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest

cron