I am messing with file uploads from a book (PHP for the world wide web, Larry Ullman) and I have tried the following script but no file us uploaded and I get a page cannot be displayed error. Any ideas as to why this is happening, the script is in a file called uploadFile.php.
thx
Code:
<html>
<head>
<title>Upload Boat Details</title>
</head>
<body>
<?php
//decide weather 2 handle form
if (isset($_POST['file']))
{
$file1 = $_POST['file'];
print ("file name: $file_name<p>\n");
print ("file size: $file_size<p>\n");
if (copy($file1, "user/$file_name"))
{
print ("your file was successfully uploaded<p>\n");
}else{
print ("your file could not be copied<p>\n");
}
unlink($file);
}
print ("upload a file to the sever:\n");
print ("<form action=\"uploadFile.php\" method=POST ENCTYPE=\"multipart/form-data\">\n");
print ("file :<input type=file name=\"file\" size=20><br>\n");
print ("<input type=submit name=\"submit\" value=\"submit\"></form>\n");
?>
</body>
</html>
thx