Forum Moderators: coopster
I'm experimenting with uploading files from a web page using the form and script below. I'm getting permission denied. Could anyone tell me how to set or gain the permission?
<form enctype="multipart/form-data" action="upload.php" 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">
And in upload.php
<?php
$uploaddir = '/var/www/uploads/';print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
print "File is valid, and was successfully uploaded. Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}?>
Thanks
I set post_max_size to like 200M and and upload_max_filesize to the same in the php.ini. Is there something I am missing to upload very large text files?
my script looks like this:
if ($userfile!= "" ¦¦ $userfile!= NULL) {
$upfile = "/var/www/html/filelistings/" . $HTTP_POST_FILES['userfile']['name'];
$upfile2 = $HTTP_POST_FILES['userfile']['name'];
copy($HTTP_POST_FILES['userfile']['tmp_name'], $upfile);
$filesql = "UPDATE jobs SET filelistings = '$upfile2' WHERE jobnumber = $jobnumber";
if (@mysql_query($filesql)) {
echo("Done");
}
}
This was more of a RedHat 8.0 issue. If you have Redhat 8 installed and your php installation was part of the initial install of the OS, Redhat installs a php.conf file in /etc/httpd/conf.d/ that basically overwrites the max file size in php.ini and sets it to 512k.
I don't know why they did this but I am glad I finally figured it out. Just for the archives.
-Russell