PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
/*
test file for uploading files
(C)opyright stefan feenstra
*/
// Voor PHP 4.1.0 moet $HTTP_POST_FILES gebruikt worden in plaats van $_FILES.
if (is_uploaded_file($_FILESї'userfile']ї'tmp_name'])) {
copy($_FILESї'userfile']ї'tmp_name'], "c:/website/upload/files/");
} else {
echo "Mogelijke aanval gespot: " . $_FILESї'userfile']ї'name'];
}
/* ...of... */
move_uploaded_file($_FILESї'userfile']ї'tmp_name'], "c:/website/upload/files");
?>
Could be an apache httpd.conf problem. What dir is your script in? try changing the upload path c:/website/upload/files/ to the dir you have your script in. See if that works. Also, try
<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES.
// In PHP earlier then 4.0.3, use copy() and is_uploaded_file() instead of move_uploaded_file
$uploaddir = 'c:/website/upload/files';
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
print "File is valid, and was successfully uploaded. 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);
}
?>
Thats outta the english manual, Give that a whirl.