I have created a small PHP file which displays the name of text files in a directory as first.txt
, second.txt
, third.txt
. On clicking on a
Try using
$dir = "/Applications/XAMPP/xamppfiles/htdocs/learning/";
as your main path with the files in it.
This full path or "../learning" should get you to the right directory to your files.
When creating a link you'll want to use "/learning/" + filename to give the path to the file.
Thanks, MyStream
Your link doesn't point correctly. When using xampp, the link should be relative to your htdocs folder, not your entire path:
/Learning/ListingFiles/first.txt
Note, that this would be the same link path you would use if your website were on the net using a domain.
It works when you use file:: because that explicitly states that the path is a file on your computer.