Could some one please tell me why this simple upload script does not work for me
submit_file.html
<HTML>
<HEAD>
<TITLE>File upload</TITLE>
</HEAD>
<BODY>
<H2>Upload</H2>
<FORM ENCTYPE="multipart/form-data" ACTION="upload_file.php" METHOD="POST">
<INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="20000">
Filename:
<INPUT NAME="userfile" TYPE="file">
<BR>
<BR>
<INPUT TYPE="submit" VALUE="Send">
</FORM>
</BODY>
</HTML>
upload_file.php
<?
// check to make sure a file has been submitted
if ($userfile=="none") {
// if not, give an error message and quit this script
echo "No file specified";
exit;
}
// send the file to a place on the server, and check to see if
// this has been done successfully.
if (move_uploaded_file($userfile, "\\uploads\\".$userfile_name)) {
echo "Your file has been uploaded.";
} else {
echo "Could not upload file.";
}
?>
Using PHP 5.0.0 and PHP 4.X.X
Everything looks OK but only echo's "Could not upload file.".
To me there seems to be a problem with the variables. To me they are not declared, but I could be wrong, as I thought this would happen in the submit_file.html.
Kind regards,