Hi all,
I have a problem that I haven't been able to solve, and now I have stared my self blind on it.
Here's the code:
<?php
if ($_POST) {
if ($_FILES['userfile']['error']) {
print "Error occured<br>";
} else {
if (!is_uploaded_file($_FILES['userfile']['tmp_name'])) {
print "Files not uploaded through HTTP POST are not allowed.<br>";
} else {
if (!move_uploaded_file($_FILE['userfile']['tmp_name'], '/tmp/newname.log')) {
print "DAMN!<br>";
}
}
}
print_r($_FILES);
} else {
print <<<END
<form enctype="multipart/form-data" action='?php print SELVF ?>' method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
END;
}
?>
And here's the output:
DAMN!
Array ( [userfile] => Array ( [name] => minicom.log [type] => application/octet-stream [tmp_name] => /tmp/phpHCCOJN [error] => 0 [size] => 105 ) )
I checked the tmp directory:
ls -al / | grep tmp
drwxrwxrwt 11 apache nobody 4096 May 27 23:55 tmp
and the httpd process:
ps -ef | grep httpd
root 1799 1 0 May27 ? 00:00:00 /usr/sbin/httpd
apache 1844 1799 0 May27 ? 00:00:00 [httpd]
apache 1845 1799 0 May27 ? 00:00:00 [httpd]
apache 1846 1799 0 May27 ? 00:00:00 [httpd]
apache 1847 1799 0 May27 ? 00:00:00 [httpd]
apache 1848 1799 0 May27 ? 00:00:00 [httpd]
apache 1849 1799 0 May27 ? 00:00:00 [httpd]
apache 1850 1799 0 May27 ? 00:00:00 [httpd]
apache 1851 1799 0 May27 ? 00:00:00 [httpd]
Needless to say that the file is nowhere to be found on the server.
I have gone though the PHP manual and postings here with no luck.
Any of you have clue as to why it's not working?
Best Regards
Jan