|
| |
|
|
nickhurd
Posts: 36 Joined: 1/26/2002 From: Status: offline
|
listing folder contents in a browser - 3/14/2005 18:08:13
I'm running a windows server and trying to give a user permissions to see the contents of a folder. Something like www.site.com/folder Is there any way to make only that folder browsable? Permissions at the folder level don't seem to work. I get access forbidden even if I'm loggin in on the administrator account I don't want the entire site to be browsable. Thanks, Nick Hurd Litening Software
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: listing folder contents in a browser - 3/14/2005 19:57:34
Nick Windows OS Version? IIS? Apache? Xitami? Using ASP, PHP, CFM? etc etc We need more details to give you an answer
_____________________________
|
|
|
|
nickhurd
Posts: 36 Joined: 1/26/2002 From: Status: offline
|
RE: listing folder contents in a browser - 3/15/2005 17:45:08
I didn't give quite enough information, did I. Windows 2003 Web Server. Asp is available.
|
|
|
|
Giomanach
Posts: 6090 Joined: 11/19/2003 From: England Status: offline
|
RE: listing folder contents in a browser - 3/15/2005 19:40:15
OK, create an ASP page, with this in it: <% 'Putting this file into a directory and calling it will list all the files in the directory as text links with 'relative paths dim FileExt(3) dim AbsolutePath dim Max 'FileExt Holds File Extension, to add new file ext write 'FileExt(4)="gif" 'then change the array dim stat. to 4 and etc... FileExt(0)="txt" FileExt(1)="htm" FileExt(2)="html" FileExt(3)="asp" Max=UBound(FileExt) AbsolutePath = Server.MapPath ("/") ShowFolderList AbsolutePath Sub ShowFolderList(FldPath) Dim fso, f, f1, s, sf Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(FldPath) Set sf = f.SubFolders For Each f1 in sf s = FldPath & "\" & f1.name ShowFiles s Next End sub Sub ShowFiles(path) dim fs,Dir,n,file set fs=server.CreateObject("Scripting.FileSystemObject") Set Dir=fs.GetFolder(path & "\") for each file in dir.files for n= 0 to Max if Right(file,len(FileExt(n)))=FileExt(n) then MakeLink file end if next next ShowFolderList path end sub Sub MakeLink(path) dim Link path=Mid(path,Len(AbsolutePath)+1) path=Replace(path,"\","/",1) file=path link="<a href=" & chr(34) & file & chr(34) & " title=" & file & ">" & file & "</a><br>" Response.Write link end sub %> That will should list the files, and provide a link to each of them. HTH Dan
_____________________________
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|