Amit20 Posted September 22, 2011 Share Posted September 22, 2011 Hello Friends, I was trying a simple file upload program But it's giving me notice. Heres the HTML & PHP Code. <html> <body> <form enctype="multipart/form-data" action="uploadFile.php"method="POST"> Select A File: <input type="file" name=uploadedFile"/> <input type="hidden" name="MAX_FILE_SIZE" value="100000"/> <input type="Submit" value="Upload File"/> </form> </body> </html> <?php $target_path="uploads/"; $target_path=$target_path.basename($_FILES['uploadedFile']['name']); if(move_uploaded_file($_FILES['uploadedFile']['tmp_name'],$target_path)) { echo "The file ".$_FILES['uploadedFile']['name']." is uploaded successfully"; } else { echo "Error uploading file"; } ?> I get the following notice: Notice: Undefined index: uploadedFile in C:\wamp\www\site\html\uploadFile.php on line 3 Notice: Undefined index: uploadedFile in C:\wamp\www\site\html\uploadFile.php on line 5 Error uploading file I cross checked the name of input tag its fine. any help will be highly appreciated! Link to comment https://forums.phpfreaks.com/topic/247663-simple-file-upload-exammple/ Share on other sites More sharing options...
voip03 Posted September 22, 2011 Share Posted September 22, 2011 Your code <input type="file" name=uploadedFile"/> missing double quotation mark <input type="file" name="uploadedFile"/> Link to comment https://forums.phpfreaks.com/topic/247663-simple-file-upload-exammple/#findComment-1271801 Share on other sites More sharing options...
Amit20 Posted September 22, 2011 Author Share Posted September 22, 2011 Thanks voip03 Got Solved! Nice Catch Link to comment https://forums.phpfreaks.com/topic/247663-simple-file-upload-exammple/#findComment-1271804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.