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!

Uploading a file

Status
Not open for further replies.

DrStern

Programmer
Mar 28, 2003
53
US
Hi there,

I'm trying to upload a file, and the following code works on windows xp, but in win2k server doesn't work.
The code is the following:

$uploadDir = 'd:/Inetpub/
$uploadFile = $uploadDir . $_FILES['userfile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadFile))
{
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
$myFile = $_FILES['userfile']['name'];
$myFile .= " es mi archivo";
print $myFile;
print "<br>";
print $myName;
print "<br>";
print_r($_FILES);
}
else
{
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}

The error message that I'm getting is the following:


Warning: move_uploaded_file(d:/Inetpub/ failed to open stream: Permission denied in d:\inetpub\ on line 16

Warning: move_uploaded_file(): Unable to move 'D:\PHP\uploadtemp\php3C.tmp' to 'd:/Inetpub/ in d:\inetpub\ on line 16
Possible file upload attack! Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => pagerror.gif
[type] => image/bmp
[tmp_name] => D:\PHP\uploadtemp\php3C.tmp
[error] => 0
[size] => 2806
)

)

Thank you guys for your help!!

Dr. Stern
 
The problem must be in ur directory permissions.

Is the dir in $uploadDir set to read only attribute.?





--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Spookie,

Thanks for replying.
I already checked the directory's permissions ( in windows explorer) and it is not read-only :(

Any other guess?

Thanks,

Dr Stern
 
It's likely a permissions problem, but also likely to be a more subtle problem than that.

What permissions exactly does the user as which your web server runs have to the directory?

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Ok, I'll have to check that, thanks, sleipnir214.

Dr. Stern
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top