Can someone translate this FSO please?
I use asp and forms all day long and I'm trying to use the FileSystemObjecct now. I have downloaded someone elses code and manipulated it in hopes of learning how to write it from scratch myself. I'm having some trouble and could use a little help translating if you can. Thanks.
Here is it code, below I have explained what I can't figure out. Thanks.
Code:
<%@ Language="VBScript" %>
<HTML>
<HEAD>
<style>
<!--
td {font-family: arial, verdana;}
a {color: #ff0000; font-size: 16px; text-decoration: none;}
a:hover {color: #000000;}
-->
</style>
</HEAD>
<BODY>
<%
Dim objFileScripting, objFolder
Dim filename, filecollection, strDirectoryPath, strURLPath
strDirectoryPath = "d:\mainweb\"
strURLPath = "http://hsdcenter/"
'get file scripting object
Set objFileScripting = CreateObject("Scripting.FileSystemObject")
'return folder object
Set objFolder = objFileScripting.GetFolder("d:\mainweb\")
'return file collection in folder
Set filecollection = objFolder.Files
'create the links
%>
<table width="530" cellpadding="5" cellspacing="0" border="1">
<tr>
<td width="180" valign="top">Testing</td>
<td width="350" valign="top">
<%
For each Filename in filecollection
filename = right(filename,len(Filename) - inStrRev(Filename, "\"))
Select Case Right(Filename,3)
Case "asp", "tml", "htm"
Response.Write("<img src='File.gif'> <a href='" & strURLPath & filename & "'>" & Filename & "</a><br>")
Case "gif", "fla", "swf", "jpg"
Response.Write("<img src='Image.gif'> <a href='" & strURLPath & filename & "'>" & Filename & "</a><br>")
Case "xls"
Response.Write("<img src='Excel.gif'> <a href='" & strURLPath & filename & "'>" & Filename & "</a><br>")
Case "exe"
Response.Write("<img src='Exe.gif'> <a href='" & strURLPath & filename & "'>" & Filename & "</a><br>")
Case "zip"
Response.Write("<img src='zip.gif'> <a href='" & strURLPath & filename & "'>" & Filename & "</a><br>")
Case Else
Response.Write("<img src='None.gif'> <a href='" & strURLPath & filename & "'>" & Filename & "</a><br>")
End Select
Next
%></td>
</tr>
<tr>
<td colspan="2" align="right"><%= strURLPath %></td>
</tr>
</table>
</BODY>
</HTML>
1. I have tried to rewrite the same thing in the left td but change it to folders instead of files and I can't get that to work.
2. I have tried to play with < input type='file'... to get an upload option on the page but I can't figure that out either.
Any help would be greatly appreciated.
Art Sapimp