The upload html page i'm using

<html>
<head> <title> </title></head>
<body> 
<form enctype="multipart/form-data" name="upload" action="upload.php" method="post">
<input  name="file4upload"  type="file"> </input> <br>
<input name="submit" type="button" value="Upload File" > 
</form>
</body>
</html>

php file code is given below (upload.php)

<?php
$target_path="upload/";
$target_path=$target_path.basename($_FILES['file4upload']['name']);
if(move_uploaded_file($_FILES['file4upload']['tmp_name'],$target_path))
{
echo " File ".basename($_FILES['file4upload']['name'])."has been uploaded";
}


else
{
echo "Unsuccessful";
}
 ?> 

i couldn't succeed in this simple upload scipt.Breaking my head for past two days.Kindly help me
It gives me following error

Notice: Undefined index: file4upload in C:\Documents and Settings\All Users\Documents\PHP practice\upload.php on line 3

**Notice: Undefined index: file4upload in C:\Documents and Settings\All Users\Documents\PHP practice\upload.php on line 4
Unsuccessful **

PHP version used 5.1
IIS version : 5.1
OS : Win Xp

Hope u'll all help me...Thanx

name="upload"

remove that from form params.
Not sure if this is the problem, but worth a try

I made a typing mistake
i haven't closed the <input> tag.it should be

<input name="submit" type="button" value="Upload File" >

</input> after <input name="submit" type="button" value="Upload File" >
Now it works
problem solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.