i want coding for upload function...actually, i want to make upload function in my system....who can help me.....plzzz anyone give me the code for upload file into system...thanks

actually, this is my coding....but i can't upload file on my system......here's i attached together my html file and php file.....anyone can help me???i real need yourhelp guyz...

html file

<html>
<head>
<title>upload a file </title>
</head>
<body>
<h1> upload a file</h1>

<form method = "post" action = "do_upload.php" enctype = "multipart/form-data">

<p><strong> file to upload:</strong><br>
<input type = "file" name = "img1" size = "30" ></p>

<p> <input type = "submit" name = "submit" value = "upload file"></p>
</form>
</body>
</html>

php ffile

<?

if ($_FILES['img1'] != "") {

	@copy($_FILES[img1][tmp_name],"/Program Files/Apache Group/Apache/htdocs/".$_FILES[img1][name])
	or die ("Couldn't copy the file.");

}else{
	die ("No input file specified");
}
?>


<html>
<head>
<title> succesful file upload</title>
</head>
<body>
<h1>success!</h1>

<p>
you sent : <? echo $_FILES[img1] [name]; ?>
a <? echo $_FILES [img1] [size]; ?> byte file with
a mime type of <? echo $_FILES [img1] [type]; ?>.</p>

</body>
</html>

What's the error ? Check if the path you have specified in copy is reachable. Also, there are some mistakes.
Its always better to use $_FILES instead of
$_FILES[img1][tmp_name]. Don't give a space between $_FILES and .

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.