Page 1 of 1

How do I read all the characters?

Posted: Sat Apr 10, 2004 5:40 pm
by joetheeskimo5
How can I read all the bytes in a document with fread() instead of entering a certain number?

Thanks,
Joe

Posted: Sat Apr 10, 2004 5:44 pm
by Weirdan

Code: Select all

$contents = fread($handle, filesize($filename));
Is this what you're looking for?

Posted: Sat Apr 10, 2004 5:47 pm
by markl999
Or file_get_contents or file if you want each line as an array element.

Posted: Sat Apr 10, 2004 5:52 pm
by vigge89

Code: Select all

<?php

$fp = fopen($filename, "r");
$filecontents = fread($fp, filesize($filename));

?>