Uploading a file

I am getting this error message when trying to use the move_uploaded_file() function. (Note: I have modified the path in the error message to remove the site specific info and replaced it with …)

Warning: move_uploaded_file(/home/…/Admin/Uploads/MeetRoster90.htm): failed to open stream: Permission denied in /home/…/Admin/meets/editProcess.php on line 53

Warning: move_uploaded_file(): Unable to move ‘/tmp/phpVsn1Vd’ to ‘/home/…/Admin/Uploads/MeetRoster90.htm’ in /home/…/Admin/meets/editProcess.php on line 53
File did not upload
[RosterFileName] => Array
[name] => swimathon.htm
[type] => text/html
[tmp_name] => /tmp/phpVsn1Vd
[error] => 0
[size] => 3698


The Upload directory has permissions of -rw-r–r-- which should be OK.

The error is generated from the following code:

$root = realpath($_SERVER[‘DOCUMENT_ROOT’]);
$uploaddir = $root.’/Admin/Uploads/’;
$uploadfile = $uploaddir . ‘MeetRoster’ . $MeetKey . “.htm”;

echo “

if (!move_uploaded_file($_FILES[‘RosterFileName’][‘tmp_name’], $uploadfile)) {
echo “File did not upload\n”;
$uploadfile = “”;
print “
  1. chmod to 755 and see if that works.
  2. Is PHP running as web server (‘dhapache’) or your user? If the former, you will need to make it run as CGI instead.

:cool: Perl / MySQL / HTML+CSS

Thanks for the advice. It turned out that my site as not set to ‘Run PHP as CGI’. As soon as I checked this option, everything worked just fine.