Click here to Skip to main content
15,885,640 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi I have working on a php code that used to upload a file actually an image using a web form. But after successfully upload the image I have got an error message saying that
'Notice: Undefined index: uploaded in C:\xampp\htdocs\test\addok.php on line 13
The file has been uploaded, and your information has been added to the directory


I don't know what is the problem in my addok.php file. However the source code will be inserted at the bottom of this post!

PHP
 <?php

$target = "images/";
$target = $target.basename($_FILES['photo']['name']);

//$name=$_POST['name'];
//$email=$_POST['email'];
//$phone=$_POST['phone'];
//$pic=($_FILES['photo']['name']);

if(move_uploaded_file($_FILES['photo']['tmp_name'],$target))
   {
       echo "The file ".basename($_FILES['uploaded']['name'])." has been uploaded, and your information has been added to the directory";
   }
   else {
       echo "Sorry, there was a problem uploading your file.";
   }

?>


If you guys have some time, please try to solve my problem.
Thanx.

Chiranthaka
Posted

As per this[^] post, it usually occurs when your variable is not properly set. Have a look at the link.
 
Share this answer
 
PHP
echo "The file ".basename($_FILES['uploaded']['name'])." has been uploaded, and your information has been added to the directory"; 
I think in this the "uploaded" should be "photo".
 
Share this answer
 
hi below code make for uploading file that store it perticular folder.'Notice: Undefined index: uploaded in C:\xampp\htdocs\test\addok.php on line 13

the link is:
onlineprojectceit.blogspot.in
 
Share this answer
 
Comments
CHill60 25-Jun-13 16:26pm    
This post was solved over a year ago!
hi below code make for uploading file that store it perticular folder.'Notice: Undefined index: uploaded in C:\xampp\htdocs\test\addok.php on line 13

the link is:
onlineprojectceit.blogspot.in/2013/06/upload-file-in-php.html
 
Share this answer
 
Comments
CHill60 25-Jun-13 16:26pm    
If you have additional information to add to a solution use the "Improve solution" link. Please do not repost the same solution again

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900