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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generate File Listing (Unix ls) into HTML Page 1

Status
Not open for further replies.

kHz

MIS
Joined
Dec 6, 2004
Messages
1,359
Location
US
How do you generate a list of files in a directory and have it create an HTML page? I cannot find an example on the Web.

Thanks.
 

If you mean a local directory (client-side), then you would have to use something like the FileSystemObject ActiveX control... but this would restrict you to IE only.

If you mean a server-side directory, then you would have to use server-side technology (ASP, PHP, CF, etc).

Hope this helps,
Dan

 
When opening the page in a browser I want to list all files in a specific directory on a Solaris server that match the user initiating the search. Then allow the user to remove the files/directories if they choose to do so.

Thanks.
 

You will have to use some sort of server-side technology to do this, then.

I suggest asking in the forum for whatever technology you wish to use (ASP, PHP, CGI, etc).

Hope this helps,
Dan

 
The easy way w/o a server side script is plain old cron with pipes and filters.... This would be a Unix script question and wouldn't update as you would like...

Another way is don't put an index or main page in the directory, and by default most webservers will generate a file listing page.

Lastly, ASP, ActiveX, ASP, Perl, CGI or other server side technology can be used.... Javascript and HTML won't do this alone.
 
In php, it's *very* simple:

then you just add some columns for editing options.
you will also need to make some functions to do something when the ACTION has been selected by the user.

How you choose to let the user post his/her action, is up to you. You can have regular hyperlinks, submit buttons, etc.

You could also have images, inside hyperlinks.. eg. A pen for edit, an X for delete, I for info? etc.

As far as the functions go: If you are to delete things, you have the function unlink()

You will however need some kind of security, blocking users from abusing your script.

If you wish to let several users admin theire own directory, you could block them out with htaccess, or maybe just php/mysql login..

You could either specify all files that belong to all users in a db, or you could simply only let them do things in theire own directory.

eg. with a db in backend, they could have access to a "virtual" directory and simply only have access to the files that are relevant to theire user_id, which has to be unique.

Olav Alexander Mjelde
Admin & Webmaster
 
Thanks, Butcher.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top