You are here: Receive file and save or echo the content « PHP Programming Language « IT news, forums, messages
Receive file and save or echo the content

Posted by Vinay Nagrik on 09/08/06 00:52

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация