PHP / IIS copy () / move_uploaded_file () could not open the stream: Permission denied Warning

I am relatively new to web development and am currently facing an error that I cannot solve.

I use IIS to test my php after entering " http: //localhost/index.html " and select the sample file to load, it generates the following warnings

Warning: move_uploaded_file(upload/Angela_Nie_resume_technical - EditedMW.doc): failed to open stream: Permission denied in C:\inetpub\wwwroot\test.php on line 26
Warning: move_uploaded_file(): Unable to move 'C:\Windows\Temp\php74F2.tmp' to 'upload/Angela_Nie_resume_technical - EditedMW.doc' in C:\inetpub\wwwroot\test.php on line 26

Below is the code related to moving my files.

$target_dir = "upload/"; 
$target_file = $target_dir . basename( $_FILES["uploaded"]["name"]) ; 
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target_file))  {
    echo "The file has been uploaded"; 
}  
else { 
    echo "Sorry, there was a problem uploading file."; 
}

I am using Windows 8.1 and using IIS to run localhost. Thank you in advance for your help!

+4
source share
2 answers

, , Apache, upload/. .

, , PHP , , . php.ini safe_mode safe_mode_exec_dir .

0

IUSR . ISS_IUSR, IUSR.

+4

All Articles