Hello all,
I've messed with this all day and I cannot figure it out.
I'm running Apache 2.0.40 with PHP Version 4.2.2 on Red Hat 8. I can't upload files, period. Here's an example, taken from elsewhere in this forum:
form.php
<form enctype="multipart/form-data" action="process.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
process.php
<?php
$uploaddir = "/home/kmurphy/public_html/tmp/";
print_r($FILES);
print_r($HTTP_POST_FILES);
print "<pre>";
if (move_uploaded_file($FILES['userfile']['tmp_name'], $uploaddir .
$FILES['userfile']['name'])) {
print "File is valid. Here is some debugging info.<br><br>\n";
print_r($FILES);
} else {
print "Possible file upload attack. <br><br>\n";
print_r($FILES);
}
?>
I receive the following output after uploading a file:
Array ( [userfile] => Array ( [name] => Kevin2.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpoW7G2E [error] => 0 [size] => 164402 ) )
File is valid. Here is some debugging info.
Array
(
[userfile] => Array
(
[name] => Kevin2.jpg
[type] => image/pjpeg
[tmp_name] => /tmp/phpoW7G2E
[error] => 0
[size] => 164402
)
)
In the /etc/php.ini file, File Uploads are turned on, and no matter which directory I specify to upload to, it never works (even if the directory is unspecified). I have tried using various copy() statements and file_is_uploaded() statements and cannot get anything to work. I have never had this problem with PHP before. The permissions for /home/kmurphy/public_html/tmp are 777.
I appreciate any help I get! Thanks!!