Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dang permission denied when permission is given

Status
Not open for further replies.

SuaveRick

Programmer
Apr 12, 2004
142
CA
I'm getting this error when I try to use my multiple file upload script:
Warning: move_uploaded_file(c:\program files\apache group\apache2\htdocs\upload\): failed to open stream: Permission denied in C:\Program Files\Apache Group\Apache2\htdocs\file_functions.inc on line 51

I've checked both the permissions on the temp folder and the upload folder I want to use, gave full control to everyone... restarted apache with an admin account even.

I can use a function I wrote to upload a single file no problem, but as soon as I try use this multiple file upload I get that error. I'm starting to think it's not a permissions error at all....

HTML:
<?
print "<html>";
print "<body>";

include('file_functions.inc');

$form="<form method=\"post\" action=\"index.php\" enctype=\"multipart/form-data\">
<input type=\"hidden\" name=\"seenform\" value=\"y\">
<input type=\"file\" name=\"uploadfile[]\"><br>
<input type=\"file\" name=\"uploadfile[]\"><br>
<input type=\"file\" name=\"uploadfile[]\"><br>
<input type=\"submit\" value=\"submit\">
</form>";

if($_POST[seenform]=="y")
{
$returnvalue=upload_multi_files("c:\\program files\\apache group\\apache2\\htdocs\\upload\\");
print $returnvalue;
}
else
{
print $form;
}
print "</body>";
print "</html>";
?>

PHP:
function upload_multi_files($uploaddir)
{
for($i=0;$i<sizeof($_FILES['uploadfile']);$i++)
{
$uploadfile=$uploaddir.basename($_FILES['uploadfile']['name']);//use the name passed by the form value 'uploadfile'
print $_FILES['uploadfile']['name'][$i]."<BR>";
if($_FILES['uploadfile']['error'][$i]== UPLOAD_ERR_OK)//if no error
{
if(move_uploaded_file($_FILES['uploadfile']['tmp_name'][$i],$uploadfile))
{
print "file uploaded ok";
return 1;
}
else
{

print "file did not upload ok<br>";
return 0;
};
}
else
{
print "file error";
return 0;
}
}
}//end of multi file upload

Getting this error:
this is uploaddir: c:\program files\apache group\apache2\htdocs\upload\
apache_pb2_ani.gif

Warning: move_uploaded_file(c:\program files\apache group\apache2\htdocs\upload\): failed to open stream: Permission denied in C:\Program Files\Apache Group\Apache2\htdocs\file_functions.inc on line 51

Warning: move_uploaded_file(): Unable to move 'C:\WINDOWS\TEMP\php23F.tmp' to 'c:\program files\apache group\apache2\htdocs\upload\' in C:\Program Files\Apache Group\Apache2\htdocs\file_functions.inc on line 51
file did not upload ok
0

Any ideas?

Thanks!
 
What server (IIS?)
How did you set the permissions? In IIS? Did you disable 'simple file sharing'?
 
I'm using apache for this one and I disabled simple file charing and gave 'EVEYONE' full control. Isn't it weird that it would work on my single upload script but not this multiple? That doesn't seem right to me, if it's a permissions error then neither should work right?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top