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


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

Reply via email to