Uploading images with $_FILES

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
lokanath7
New php-forum User
New php-forum User
Posts: 139
Joined: Mon Nov 15, 2010 12:11 am

Fri Dec 03, 2010 7:47 am

instead of

if(isset($_FILES['photo'])&& is_uploaded_file($_FILES['photo']['temp_name']) && $_FILES['photo']['error']==UPLOAD_ERR_OK)


u have to use

if(isset($_FILES['photo'])&& is_uploaded_file($_FILES['photo']['tmp_name']) && $_FILES['photo']['error']==UPLOAD_ERR_OK)

the only error was "temp_name" => "tmp_name" but ur code dosent move the required file to any folder. If u want to do that then u hav to use move_uploaded_file("tempname","destination").

lokanath7
New php-forum User
New php-forum User
Posts: 139
Joined: Mon Nov 15, 2010 12:11 am

Fri Dec 17, 2010 12:11 am

u r welcom

meerakarthik

Wed Feb 09, 2011 5:47 am

this is a code..........................image only not uploading..............but other things fine.........
help me to fix this

<?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";
}

?>

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 2 guests