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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.