benjrox Posted August 23, 2006 Share Posted August 23, 2006 Hi, I have a script that phases a chat log from a IM program to HTML, but when the chat log is bigger then 100KB (I think) it doesn't display a thing. Anything lower works perfectly.Here's the code:PHP:[code] $pext = getFileExtension($log_name); $pext = strtolower($pext); if ($pext != "txr") { unlink($log); die("Bad file type, please upload a Log file (.txr only)."); } else { $handle = fopen($log, "r"); $contents = ''; if($handle) { while (!feof($handle)) { $contents .= fread($handle, filesize($log)); } echo fix($contents); fclose($handle); } }[/code]Upload HTML:[code]<form method="post" enctype="multipart/form-data" action="<? echo $PHP_SELF ?>"> Log file (.txr): <input type="file" name="log" size="30" /> <input type="hidden" name="action" value="1"> <br /> <br /> <input type="submit" value="View Log"></form>[/code]Thanks,Benj Link to comment https://forums.phpfreaks.com/topic/18378-reading-a-large-text-file/ Share on other sites More sharing options...
zq29 Posted August 23, 2006 Share Posted August 23, 2006 Have you tried just dumping the contents of the file into a variable with file_get_contents() ?I can't see why it should fail on files over 100k - How long is it taking to execute? Link to comment https://forums.phpfreaks.com/topic/18378-reading-a-large-text-file/#findComment-79050 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.