I generally don't do PHP coding on Windows, but I've recently had to move one of the websites I administer to a Windows box. :queasy: I'm having trouble with the move_uploaded_file() function.
Here's the relevant code:
//$uploaddir = '/var/www/columbine/george/'; // when it was on Linux
$uploaddir = "D:\\\\WWWWEBS\\\\columbinechurchofchrist_org\\\\george\\\\";
$uploadfile = $uploaddir . $_FILES['userfile']['name'];
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "Thanks!<br>File is valid, and was successfully uploaded. ";
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
Here's the error message I'm getting:
PHP Warning: move_uploaded_file(D:\WWWWEBS\columbinechurchofchrist_org\george\temp.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in D:\WWWWEBS\columbinechurchofchrist_org\admin\georgesfileuploads.php on line 25 PHP Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:\php\uploadtemp\php7D.tmp' to 'D:\WWWWEBS\columbinechurchofchrist_org\george\temp.txt' in D:\WWWWEBS\columbinechurchofchrist_org\admin\georgesfileuploads.php on line 25
PHP is not running in safe mode
upload_tmp_dir is defined to be "D:\php\uploadtemp\" in php.ini
The D:\WWWWEBS\columbinechurchofchrist_org\george\ directory exists
Line 25 is the move_uploaded_file() line
[/list=1]Here's what's printed by print_r:
Possible file upload attack! Here's some debugging info: Array ( [userfile] => Array ( [name] => temp.txt [type] => text/plain [tmp_name] => D:\php\uploadtemp\php7D.tmp [error] => 0 [size] => 225 ) )
Any ideas, anybody? I've searched all over for a solution to this but haven't really come up with anything. Help would be greatly appreciated.