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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file upload problem

Status
Not open for further replies.

ascikey

Programmer
Feb 18, 2004
127
GB
Hi all, I have the following file upload script
from with a few adjustments made for my computer. My question is does anybody know why the file is uploading to the boat directory and not the user directory [shocked]

Code:
<?php
$uploaddir = 'C:\Program Files\Apache Group\Apache2\Personal\ses\emporium\boats\user';
$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";
   print_r($_FILES);
} else {
   print "Possible file upload attack!  Here's some debugging info:\n";
   print_r($_FILES);
}
print "</pre>";
?>
 
have you tried putting an extra '\' at the end of $uploaddir? it might be treating 'user' as part of the name
 
Try changing:

$uploadfile = $uploaddir . $_FILES['userfile']['name'];

to:

$uploadfile = $uploaddir . '\' . $_FILES['userfile']['name'];

 
already tried them both just gives a parse error ?? then take it back out and it uploads fine to boat dir, thx for your reply's anyhow
 
ok that is strange because this worked
Code:
$uploaddir = 'user/';
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top