|
Posted by Vinay Nagrik on 09/08/06 17:30
Hello Group members,
I have access to server side php script which takes parameters from a
form and processes
the buffer and saves the file.
However, I, as an implementor, do not have the luxury to use form based
scripts. All I want
to do is telnet to server and type in whole buffer/filename and use
Header for Content_disposition.
For buffers I would use
Content-Disposition: inline // Send the buffer
and if 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;
I want the server to echo the content of the buffer and save the file
in the filename variable.
I am successful using the form, but this is not what I want to do. I
want to telnet to the server
which can take the post request and follow my wishes.
The following two scripts do not serve my purpose. because they are
designed to work with
forms. Could someone tell me what need I change in these scripts so
that these will work
with the command line.
*********************Two scripts do not serve my purpose
<?php
$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>";
?>
and ----------------
<?php
print_r($_POST);
?>
*****************************
Thanks in advance.
nagrik
[Back to original message]
|