Jump to content

Archived

This topic is now archived and is closed to further replies.

gentlemanintraining

moving data within a textarea field to a text file

Recommended Posts

I'm trying to create a form where users can submit information to a database, but one of the forms (a textarea) has to generate a text file. How do I get data within a textarea box to generate a randomly titled text file? I'd also like to know how I can get the file-name of that generated text file, so I can add it to MySQL.

Share this post


Link to post
Share on other sites
[code]<?php
$filename = md5(microtime());
$fp = fopen("files/{$filename}",'w');
fwrite($fp,$_POST['file_contents']);
flclose($fp);

mysql_query("INSERT INTO ......");
?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.