Bekijk de volledige versie : Upload file via httpd
Can anyone has experience that to make the upload file work via http?
I setup thttpd with wl500g and I want to be able to upload file via the http instead of FTP.
I tried many of those cgi , php scripts but none of them works.
Can anyone tell me or send me me the script which works with thttpd?
I have tested phpinfo() which is working fine.
thx:D
This is from the PHP online documentation :
(http://dk2.php.net/features.file-upload)
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>
Thanks a lot
Finally figure out where the problem is (but still dont know how to fix)
the upload only works for a tiny size of text file. the max size i successfully uploaded is 218 byte.
I dont know where goes wrong, I have the upload_max_filesize set to 2M but still got the problem. I guess it has something to do with the memory on wl500g but i have 512MB of swap space assigned.
Dont know what to do now.
This is from the PHP online documentation :
(http://dk2.php.net/features.file-upload)
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
?>