Connecting Tech Pros Worldwide Forums | Help | Site Map

Receive file and save or echo the content

Vinay Nagrik
Guest
 
Posts: n/a
#1: Sep 8 '06
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($_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>";

?>

**************to save the file

Thanks in advance.

nagrik


Closed Thread


Similar PHP bytes