I have been having trouble getting a simple file upload to work, I copied the non working script directly from the php manual at http://www.php.net/manual/en/features.file-upload.php
The manual shows that you can do a file upload by using the scripts outlined below... however, my problem is that when I try this, the file never seems to actually get uploaded to the server, in fact when I check the value of $userfile, it is always "none."
I tried redefining the upload_tmp_dir value in php.ini but that does no good. I really need to figure out what is wrong here. I am using the scripts below (substituting the path in "upload.php" for a local path on my computer.
<!--index.html -->
<body>
<FORM ENCTYPE="multipart/form-data" ACTION="upload.php" METHOD=POST>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000">
Send this file: <INPUT NAME="userfile" TYPE="file">
<INPUT TYPE="submit" VALUE="Send File">
</FORM>
</body>
<!-- upload.php -->
<?php
if (is_uploaded_file($userfile)) {
copy($userfile, "/place/to/put/uploaded/file");
} else {
echo "Possible file upload attack: filename '$userfile'.";
}
?>
I have this problem on both a windows 2000 machine as well as a linux 7.0 machine. On the one hand I think it has got to be something I am doing, and yet on the other hand the scripts were copied directly from the phop manual. ANY HELP would be highly appreciated.
Alan