Jens Gyldenkærne Clausen wrote
> Bertel Strandbygaard skrev:
>
>
>>Nu vil jeg gerne have en side hvor jeg viser hvilke filer som jeg
>>har liggende i den enkelte mappe - vist med filnavn, og med
>>hyperlink.
>
>
> Du kan se en mulighed her:
> <
http://www.gyros.dk/usenet/asp/visfiler.asp>.
>
> Du kan se hvordan filen virker her:
> <
http://www.gyros.dk/usenet/html> (den er den fil der genererer
> oversigten).
Her er en variant av det samme som også viser HTTP Server Variables
Collection.
Filene kan også redigeres (hvis du skriver filen edit.asp selv).
<%
<%
Option Explicit
Dim oFSO, oFile, oFolder, oFiles
Dim sPath, sPhysicalPath, Key
sPath = Request.ServerVariables("PATH_INFO")
sPhysicalPath = Server.MapPath(sPath)
Set oFSO = Server.CreateObject("Scripting.FileSystemObject")
Set oFile = oFSO.GetFile(sPhysicalPath)
Set oFolder = oFile.ParentFolder
Set oFiles = oFolder.Files
%>
<html>
<head>
<title>Showing Files in Folder</title>
<style type="text/css">
table {
font-family: verdana;
font-size: 0.8em;
}
</style>
</head>
<body>
<table width="100%" cellpadding="5" border="1">
<tr align="center">
<th align="left">File</th>
<th>Type</th>
<th>Size</th>
<th>Last modified</th>
<th>Edit</th>
</tr>
<%
For Each Key in oFiles
%>
<tr>
<td align="left">
<a href="<%= Key.Name %>"><%= Key.Name %></a>
</td>
<td align="center"><%= Key.type %></td>
<td align="center"><%= Key.size %></td>
<td align="center"><%= Key.DateLastModified %></td>
<td align="center">
<a href="edit.asp&file=<%= Key.Name %> ">Edit</td>
</tr>
<%
Next
%>
</table>
<div style="font-size:11; font-family: verdana; margin-top: 2em;">
File: <b><%= oFile.Name %></b><br>
Server Path: <b><%= sPath %></b><br>
Physical Path: <b><%= oFile.Path %></b><br>
File Size: <b><%= oFile.size %> bytes</b><br>
Date Created: <b><%= oFile.DateCreated %></b><br>
Date Last Modified: <b><%= oFile.DateLastModified %></b><br>
Date Last Accessed: <b><%= oFile.DateLastAccessed %></b><br>
</div>
<h2>The HTTP Server Variables Collection</h2>
<table border="1" width="100%">
<tr>
<td><b>Variable Name</b></td>
<td><b>Value</b></td>
</tr>
<%
For Each Key in Request.ServerVariables
Response.Write "<tr><td><b>" & Key & "</b></td><td>"
If Request.ServerVariables(Key) = "" Then
Response.Write " "
Else
Response.Write Request.ServerVariables(Key)
End If
Response.Write "</td></tr>"
Next
Set oFiles = Nothing
Set oFolder = Nothing
Set oFile = Nothing
Set oFSO = Nothing
%>
</table>
</body>
</html>
terje