I have a problem with "open_basedir restriction in effect" errors on using move_uploaded_file. GD is installed and enabled, Safe mode is off and open_basedir is set to the web site's root (all confirmed in phpInfo). I am using php 5.2.8 under IIS and have given IIS_IUSRS full control permissions on the receiving folder (a sub-directory of the web site's root).
I have a properly validated full script but this is my cut-down test that displays the problem...
Code: Select all
[color=#000080]<html>
<head><title>PHP image resize</title></head>
<body>
<?php
if (!isset($_POST['submitted']))
{
?>
<form method='post' action='test.php' enctype='multipart/form-data'>
<input name='submitted' type='hidden' value='TRUE' />
File: <input name='imagefile' type='file' />
<input name='submit' type='submit' value='Submit' />
</form>
<?php
}
else $moved = move_uploaded_file($_FILES['imagefile']['tmp_name'], $_SERVER['DOCUMENT_ROOT']."\\images\\".$_FILES['imagefile']['name']);
?>
</body>
</html>[/color]
Submitting a valid file using this page generates the following errors;
PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]:
open_basedir restriction in effect. File(C:\Windows\Temp\phpF6F4.tmp) is not within the allowed path(s):
(C:\inetpub\wwwroot\default) in C:\inetpub\wwwroot\default\test.php on line 15
PHP Warning: move_uploaded_file(C:\inetpub\wwwroot\default\images\108_6079.JPG)
[<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]:
failed to open stream: Permission denied in C:\inetpub\wwwroot\default\test.php on line 15
PHP Warning: move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]:
Unable to move 'C:\Windows\Temp\phpF6F4.tmp' to 'C:\inetpub\wwwroot\default\images\108_6079.JPG'
in C:\inetpub\wwwroot\default\test.php on line 15
I have run out of ideas (though my inclination is to think the problem is in the IIS or Windows security area) - any suggestions?
:banghead: Please!!
P.S. I know what I'm doing IT-wise but am relatively new to PHP.