Receive file and save or echo the content

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vinay Nagrik

    Receive file and save or echo the content

    Hello group members,

    I want to send a file "a.b" and I want server to save this file on the
    server in
    filename "abcde" then I will send the file content as buffer and
    include the following
    header

    Content-Disposition: attachment; filename=abcde;

    and if I want to send a stream I will have the following header

    Content-Disposition: inline

    I want the server to echo the content of the buffer and save the file
    in the filename variable.

    I am aware of the form interface, but I do not want the server side
    script to read form data.
    Instead I want to telnet to the server which can take the post request
    and follow my wishes.

    The following two scripts do not serve the purpose, What need I
    change in these scripts so
    that I can do the needful.

    <?php
    print_r($_POST) ;
    ?>

    ************** to echo the content and

    <?php
    $uploaddir = '/var/www/uploads/';
    $uploadfile = $uploaddir . basename($_FILE S['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>";

    ?>

    **************t o save the file

    Thanks in advance.

    nagrik

Working...