Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to list folder contents? 2

Status
Not open for further replies.

robFSS

IS-IT--Management
Apr 29, 2003
106
US
Let's say I made a folder on my webspace called "dl" where I want to store some various documents for customers to download.

Is there a way to use simple html to display the contents of this folder, even if they contents change?

So for example the document "sample.pdf" is stored in "
If on my home page, I make a link to my document, the PDF just pops right open when I click it. If I try to navigate to the almost empty /dl/ folder, the browser returns a 404 error.
I made a blank index.htm or default.htm doc in the /dl/ folder, which allows visit a blank webpage, but there's no indication that any (pdf or other) documents are in that directory.

Now we've all been to webpages that show us an index of folder contents, some times there's even multiple files trees. Is this a web-server feature? Can I mimic this to display a short list of folder contents on my website just using HTML?
 
You may be able to alter your webserver settings to allow directory listings. All you need to do is point a browser at the directory and the server will create an HTML page for you.
That's the easy way.

Other than that, no you can't use simple HTML to do it I'm afraid.

You can, however use a server side scripting language such as PHP or ASP to create the listing and deliver it as an HTML page.


<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Now we've all been to webpages that show us an index of folder contents, some times there's even multiple files trees.
True. But security settings on most web servers prevent that potential security hazard. As Foamcow pointed out, you may or may not be able to override those settings.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Thanks to both of your guys for your feedback.

I was wondering about security as well.

One other question.

Is there a specific tag to use to create a link that prompts the web surfer to save a local copy of the target document, rather than just automatically opening the document?

In the case of this PDF document available for download on my website >>--> When I click the link to this document, it just automatically launches adobe reader and displays the document. I know that these days users have a particularly broad set of options when it comes to displaying PDFs in their browsers.

Other than zipping the PDF, is there any way to enforce that the user download and save the document before opening it, and then doing a "save as"?

thx,
-r
 
Nope, that's controlled client side and is dependant on how the user's machine is set up. Although it is possible to 'spoof' it server side by manually altering the headers sent to the browser.

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top