Re: Creating a text file
| From: | Richard Lynch | Date: | Sat, 21 Jul 2007 00:09:17 +0000 |
| Subject: | Re: Creating a text file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-259268@lists.php.net to get a copy of this message | ||
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?