Jump to content


Photo

moving data within a textarea field to a text file


  • Please log in to reply
1 reply to this topic

#1 gentlemanintraining

gentlemanintraining
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 15 October 2006 - 08:30 AM

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.

#2 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 15 October 2006 - 10:06 AM

<?php
$filename = md5(microtime());
$fp = fopen("files/{$filename}",'w');
fwrite($fp,$_POST['file_contents']);
flclose($fp);

mysql_query("INSERT INTO ......");
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users