I am unable to upload file to my local host folder in php.

Posted by Nauman khan on Stack Overflow See other posts from Stack Overflow or by Nauman khan
Published on 2011-01-02T13:51:15Z Indexed on 2011/01/02 13:53 UTC
Read the original article Hit count: 251

Filed under:
|
|

Hi, I have the follwing code

<form enctype="multipart/form-data" action="upload.php" method="POST">
 Please choose a file: <input name="uploaded" type="file" /><br />
 <input type="submit" value="Upload" />
 </form>  

<?php 
 $target = "upload/"; 
 $target = $target . basename( $_FILES['uploaded']['name']) ; 
 $ok=1; 
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) 
 {
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
 } 
 else {
 echo "Sorry, there was a problem uploading your file.";
 }
 ?> 

my page is in http://localhost/nausal/upload.php

now I am having the follwing error though i have created a folder in site with name upload.

Notice: Undefined index: uploaded in C:\wamp\www\Nausal\upload.php on line 15

Notice: Undefined index: uploaded in C:\wamp\www\Nausal\upload.php on line 17 Sorry, there was a problem uploading your file.

Please help me I am very new to php. :(

© Stack Overflow or respective owner

Related posts about php

Related posts about php5