On Thu, 2003-03-06 at 15:33, John Taylor-Johnston wrote: > I'm looking for a couple of lines of code so I can upload the contents of a *.txt > into a buffer and declare it as a string so I can spit it back in a <textarea>. I > don't want to necessarily upload a text file, only load it into a buffer. > > I'm lost
Will this do? $fh=fopen($_FILES['userfile']['tmp_name'], 'r'); $fileContents=fread($fh, filesize($_FILES['userfile']['tmp_name'])); fclose($fh); Assuming your form looked like this: <form enctype="multipart/form-data" action="uploadintostring.php" method="post"> <div>Read this file: <input name="userfile" type="file"></div> <div><input type="submit" value="Read File"></div> </form> You can view this in action at http://nikmakepeace.com/goodies/upload-string.php Nik -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php