Re: Creating a text file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, July 17, 2007 9:29 pm, Ryan Lao wrote:
> i made a simple PHP form that would ask for the users complete name, a
> button that would browse to a file that the user wants to upload, a
> text
> area for additional comments, and a submit button. This form works
> just
> fine. what i want to achieve next is for my form to also create a text
> file
> when it is submitted. The text file will contain the users complete
> name,
> the filename that was being uploaded and the additional comments from
> the
> user. Can anyone give me some ideas on how to do this?

http://php.net/file_put_contents

<?php
$file = file_get_contents($_FILES['name_from_html_form']);
file_put_contents("textfile.txt", "$name\n$comments\n$file");
?>

This is shockingly devoid of error checking and input filtering.

Start reading here:
http://phpsec.org/

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux