Results 1 to 3 of 3

Thread: Upload file via httpd

  1. #1

    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

  2. #2
    This is from the PHP online documentation :

    (http://dk2.php.net/features.file-upload)

    PHP Code:
    <?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>";

    ?>
    macsat
    http://www.macsat.com - Tutorials and information on using ASUS WL-500G and family.

  3. #3
    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.

    Quote Originally Posted by macsat
    This is from the PHP online documentation :

    (http://dk2.php.net/features.file-upload)

    PHP Code:
    <?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>";

    ?>

Similar Threads

  1. Firmware v1.9.2.7 CR7 now 7g [Oleg]
    By Oleg in forum WL-500g Firmware Releases
    Replies: 270
    Last Post: 23-10-2007, 22:00
  2. problems with file handling or file size
    By black_bottom in forum WL-HDD Q&A
    Replies: 1
    Last Post: 28-03-2006, 16:55
  3. Dokuwiki File upload fails
    By Fweem in forum WL-500g Q&A
    Replies: 1
    Last Post: 11-02-2006, 11:16

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •