hi there
I have a directory with php example files, and I've generated the list of the files as a href.
How can I display the content of any file I've click. I was thinking to read the file using fgets().
is that possible? or how to do that?
| SitePoint Sponsor |

hi there
I have a directory with php example files, and I've generated the list of the files as a href.
How can I display the content of any file I've click. I was thinking to read the file using fgets().
is that possible? or how to do that?
Yes. You will need to have the php script serve the proper mime headers depending on the type of file. You can do this with the header() function. readfile() would be easier than fgets in any case. But if you just want the browser to display the contents as you would see if you opened the file in say, notepad, then just serve all files as content-type: text/plain



Bookmarks