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 "<pre>";
print "Attempting to copy to $uploaddir\n";
print "Filename: $uploadfile\n";
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>";
?>
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 ?
The script is:
<?php
$uploaddir = 'public_ftp/incoming';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
print "Attempting to copy to $uploaddir\n";
print "Filename: $uploadfile\n";
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>";
?>
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 ?