fread or not?

From: Date: Thu, 06 Mar 2003 03:41:01 +0000
Subject: fread or not?
Groups: php.general 
Request: Send a blank email to php-general+get-138408@lists.php.net to get a copy of this message
I need to upoload a local text file into memory using: <input type=\"file\" name=\"filename\" /> The script below will only work if I am using my localhost. Any ideas? John <?php echo "<form action=testthis.php method=post>\n"; if (!$filename) { echo "!\$filename <input type=\"file\" name=\"filename\" />\n"; }else{ #$filename = "/usr/local/something.txt"; #echo "\$filename $filename\n"; $handle = fopen ($filename, "r"); $contents = fread ($handle, filesize ($filename)); fclose ($handle); if($contents){echo"<textarea cols=50 rows=6 nowrap>$contents</textarea>";} else{echo "no contents there";} } echo "<input type=\"submit\" />\n"; echo "</form>\n"; ?>

« previous php.general (#138408) next »