<BLOCKQUOTE><font size="1" face="Verdana, Arial">code/font><HR><pre>
int fpassthru(int filepath/goes/here.txt);
[/code]
I could be wrong...let me know if it works. That command should print out the entire file from beginning to end...
------------------ Chris Bowyer – chris@mycoding.com MyCoding.com: Visit for Launch Notification! DomainMailings.com: Who Says All The Good Ones Are Taken? MovieForums.com: Talk About Your Favorite Flicks!
My mistake, and another testament to your greatness, O Kevin.
------------------ Chris Bowyer – chris@mycoding.com MyCoding.com: Visit for Launch Notification! DomainMailings.com: Who Says All The Good Ones Are Taken? MovieForums.com: Talk About Your Favorite Flicks!
I can't seem to get it to print out everything, with the lines too.
As in, it prints are everything on 1 line.
I changed file to $file as it produced an error.
but then after that, it showed the data on 1 whole line ( instead of several lines ) and produced an error thereafter.
Warning: Unable to find file identifier 1 in /home/nortiq/www/temp.php on line 4
First of all you're right, it should have been "$file", not "file".
The error message you're getting seems to be coming from the fact that fpassthru() implicitly closes the file after outputting its contents. Thus, the fclose() line is unneccessary.
As for why the contents of the file are appearing on one line, that's just Web browsers for you. If you choose View Source in your browser, you'll see that the file was actually output correctly. It's just that the Web browser is reading it as a Web page and thus flows all the lines together.
If you just want to display the contents of the file (i.e. you have no HTML elements in the page), you can tell the browser to interpret the page as a plain text file instead by adding the following line to the top of your PHP script:
header("Content-Type: text/plain");
Alternatively, you can surround the file's contents with <PRE>...</PRE> to preserve the end-of-lines and extra whitespace.
If neither of these options is acceptable, let me know and I'll show you the code that will read the file into a PHP variable and convert it into the HTML code neccessary to display it.
Bookmarks