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

<title>upload a file </title>
<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>

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.");

	die ("No input file specified");

<title> succesful file upload</title>

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


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 .

This article has been dead for over six months. Start a new discussion instead.