PDA

View Full Version : Directory viewer / PDF viewer


elcaro2k
04-29-2003, 08:56 PM
I was wondering if there is a way I could produce a view of directories to the user in which they could click and open directories until they get to the PDF report they want and then click the file to open the pdf?

Thanks,
Ray

brothercake
04-29-2003, 08:59 PM
Not in javascript; can you run a server-side language - if so, which one, and I'll move this to the appropriate forum.

elcaro2k
04-29-2003, 09:00 PM
Yes, ASP. Thanks!!!

Roy Sinclair
04-29-2003, 09:29 PM
In IIS (via the MMC or the admin web pages) change the "Properties" of the directory you want the users to start in to allow directory browsing. Your users will then be able to hunt up and down the directories past that directory using capabilities that are already built into both IIS and the browsers.

You only have to use server side code if you want to make your own list and format it some way other than the default.

rsci
04-29-2003, 09:29 PM
Turn on directory browsing for the folders.

elcaro2k
04-29-2003, 09:30 PM
No, I wish it were that easy, they want formating...

Roy Sinclair
04-29-2003, 09:41 PM
Here's the crude code you can start with to make it how you want:


<html>
<head><title>File List</title>
</head>
<body>

<ol>
<%
Set myFileSys = Server.CreateObject("Scripting.FileSystemObject")
Set Folder = myFileSys.GetFolder(Server.MapPath("/"))
for each file in Folder.Files
FileName = Left(file.name, (Len(file.name) - 4)) 'drop the extension
FileSize = cint(file.size / 1024) 'convert into kilobytes and drop the decimal
Response.Write("<li><a href='/" & file.name & "'>" & FileName & "</a> - " & FileSize & " K<br>" & chr(13))
next

Set myFileSys = nothing
%>
</ol>
</body>
</html>

elcaro2k
04-30-2003, 01:59 PM
Thanks to everyone. I am all set now!!!