Re: <input type="file" name="txt_file" />
| From: | Marek Kilimajer | Date: | Thu, 06 Mar 2003 09:53:15 +0000 |
| Subject: | Re: <input type="file" name="txt_file" /> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-138442@lists.php.net to get a copy of this message | ||
Everything you need is here:
http://www.php.net/manual/en/features.file-upload.php#features.file-upload.post-method
John Taylor-Johnston wrote:
Instead of using fread, I want to upload a *.txt file using: <input type="file" name="txt_file" /> and display it in a textarea. Where do I go now? Specifically, how do I get $contents? Thanks, John <?php $filename = "/usr/local/something.txt"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); if ($contents){echo"<form><textarea>$contents</textarea></form>";} else{echo "no contents there";} ?>