[Solved] Error With Simple Upload File Form
Posted: Wed Mar 17, 2004 5:23 pm
Below is my simple code:
and the php file
When I open the html page and choose a file to upload and submit it loads the php page with the following error.
Notice: Use of undefined constant img1 - assumed 'img1' on line 2
Couldn't copy the file.
any ideas?
Code: Select all
<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>Code: Select all
<?
if ($_FILESїimg1] != ""){
@copy($_FILESїimg1]їtmp_name],
"/Apache/htdocs/temp/".$_FILESїimg1]їname])
or die("Couldn't copy the file.");
}else{
die("No input file specified");
}
?>
<html>
<head>
<title>Successful 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>Notice: Use of undefined constant img1 - assumed 'img1' on line 2
Couldn't copy the file.
any ideas?