Jump to content

Simple File upload Exammple!


Amit20

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.