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";}
?>






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to