I want to create a index.html file so that when the user goes to the web folder they see all the files that are in the folder and right click what file they want and then simply save as.
How do I create a html page that allows the viewer to see all the files that are in that web folder?
Bob W is partially correct. web servers are configured to look for a default document in a folder, if you do not specify an actual page. they can even be configured to look for multiple files like default.htm, default.asp, index.htm, index.html, index.aspx, etc. you don't need to remove these defaults, only make sure than none of these files exists in the folder.
however, for security reasons, most web servers are configured to NOT show a list of files when no default page is present and no page is specified. on a Windows web server, this is the default behavior and must be changed to show files.
to answer your question directly, there is no way to do this using a simple html file. you must run server-side code to get a list of files on the server and display them. this would require .asp or .php or .cgi type dynamic pages that run on the server and output html to the client.
Reply:In addition to Bob W's answer, if you still don't see a list of what is in the folder just by omitting an index file, upload a .htaccess (Apache server only) file with the following line in it:
Options +Indexes
Alternatively you can use server side scripting such as PHP to produce a html formatted list of all files in a directory - here's a tutorial showing the php code involved: http://www.devpapers.com/article/62
Reply:wat type of server is it running on?
Reply:Actually, if you omit the index file altogether, many web servers default to displaying the contents of the folder. Try it; you might get lucky and your server will exhibit this behavior. Make sure there are no files whose names start with "index.".
printable cards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment