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 Shaun E 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.

pcsmurf

IS-IT--Management
Apr 26, 2002
47
GB
I have written what should be a straight forward uploading script which doesn't work and I don't know why.

The script is:

<?php
$uploaddir = 'public_ftp/incoming';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];

print &quot;<pre>&quot;;
print &quot;Attempting to copy to $uploaddir\n&quot;;
print &quot;Filename: $uploadfile\n&quot;;

if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print &quot;File is valid, and was successfully uploaded. &quot;;
print &quot;Here's some more debugging info:\n&quot;;
print_r($_FILES);
} else {
print &quot;Possible file upload attack! Here's some debugging info:\n&quot;;
print_r($_FILES);
}
print &quot;</pre>&quot;;

?>

The resulting screen message is:

Attempting to copy to public_ftp/incoming
Filename: public_ftp/incoming
Possible file upload attack! Here's some debugging info:
Array
(
[file] => Array
(
[name] => Aelgo_new.gif
[type] => image/gif
[tmp_name] => /tmp/phpPOeNiT
[error] => 0
[size] => 6056
)

)

My web hosts say the folder permissions and everything else their end is fine so it must be my code.

Anyone got any ideas ?
 
Always something silly isn't it! Thanks all is fine now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top