1.

Solve : PHP - read text file on click?

Answer»

Good day to all,

HEY guys, I'm writing a small project for myself and I need some help. I can read the file names from a folder using readdir function and set the names as links to the file destination.

How do I go about making a script that will read the contents of the text file that was clicked on?

EX. Main folder called: root

/root/file1.txt
/root/file2.txt
/root/file3.txt

On the WEBPAGE the script will read each file name and print them on the page as links like this:

...file1.txt
...file2.txt
...file3.txt

When I click on the link the file will OPEN in the browser directly, but I am looking for a way of identifying which file has been clicked so I can open that file for reading and manipulate the contents inside.

Any help is appreaciated, thank you.Nvm, PROBLEM solved.



Discussion

No Comment Found