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

File Upload Directory Listing

Status
Not open for further replies.

chellweg

IS-IT--Management
Dec 8, 2003
20
US
I have a file upload script I am working on, and the uploading works fine. The part that I want to add that I am not sure about is this: I want the asp page to create a list of the files that exist in the upload directory and have a hyperlink to them to allow them to be downloadable right away. The script is in the root dir, and the files get uploaded to root\files. How do I get the directory listing and then parse that list to create my hyper links?

Christopher
 
<%
Dim strPath 'Path of directory to show
Dim objFSO
Dim objFolder
Dim objItem
strPath=&quot;./files&quot;

Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set objFolder = objFSO.GetFolder(Server.MapPath(strPath))

response.write &quot;<TABLE>&quot; &_
&quot;<tr><TD>Description</td>&quot; &_
&quot;<TD>Size</TD>&quot; &_
&quot;<TD>Date</TD></TR>&quot;

For Each objItem In objFolder.Files
response.write &quot;<tr><TD><A HREF=&quot;&quot;&quot; &_
strPath & objItem.Name &_
&quot;&quot;&quot;>&quot; & objItem.Name & &quot;</A></TD>&quot; &_
&quot;<TD>&quot; & objItem.Size & &quot;</TD>&quot; &_
&quot;<TD>&quot;& objItem.DateCreated & &quot;</TD></TR>&quot;

Next
response.write &quot;</TABLE>&quot;

Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top