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!
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!