I am trying to write a script which uploads a file via a html form. When I click submit nothing happens.
file: upload_form.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form action="do_upload.php" method="post" enctype="multipart/form-data"></form>
<p><strong>File to upload</strong></p>
<p><input name="img1" type="file" size="30" /></p>
<p><input name="submit" type="submit" value="Upolad File" /></p>
</body>
</html>
file: do_upload.php
<?php
if ($_FILES[img1] != "" {
@copy($_FILES[img1] [tm_name], "/tmp" .$_FILES[img1][name])
or die("couldnt copy the file");
} else {
die("no file specified");
}
?>
<HTML>
<head>
<title>Successfull File Upload</title>
</head>
<body>
<h1>Success</h1>
<p>You sent: <? echo $_FILES[img1][name]; ?>, a <? echo $_FILES[img1][size]; ?>byte filw with a mime type of <? echo $_FILES[img1][type]; ?></p>
</body>
</HTML>