View Single Post
  #3 (permalink)  
Old June 14th, 2006, 01:20 AM
kingroon kingroon is offline
Authorized User
Points: 136, Level: 2
Points: 136, Level: 2 Points: 136, Level: 2 Points: 136, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2006
Location: London Town, , United Kingdom.
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Chetrity,

I guess the first problem is that using the <input type="file"> you have to select an actual file rather than a direcrory..

Try this..

Code:
<% Option Explicit %>

<html>
<head>
<title>Untitled</title>
</head>

<body>

<form action="<%= Request.ServerVariables("SCRIPT_NAME") %>" method="post">

<input type="text" name="directory" value="C:\WINDOWS\system32"/> <input type="submit">

</form>

<%
Dim strPath, fso, fsoFolder, fsoFile, i
If Request.Form("directory") <> "" Then
    strPath = Request.Form("directory")
    If Not Right(strPath, 1) = "\" Then
        strPath = strPath & "\"
    End If
    Set fso = Server.CreateObject("Scripting.FileSystemObject")
    If fso.FolderExists(strPath) = True Then
        Set fsoFolder = fso.GetFolder(strPath)
        Response.Write("Folder " & strPath & " exists.<br><br>")
        i = 1
        For Each fsoFile In fsoFolder.Files
            If UCase(fso.GetExtensionName(fsoFile.Name)) = "JPG" Or _
                UCase(fso.GetExtensionName(fsoFile.Name)) = "GIF" Or _
                UCase(fso.GetExtensionName(fsoFile.Name)) = "BMP" Or _
                UCase(fso.GetExtensionName(fsoFile.Name)) = "PNG" Then
                i = i + 1
                Response.Write "<img src=""" & strPath & fsoFile.Name & """ height=""80"" border=""0"" alt=""" & fsoFile.Name & """>"
                If i = 10 Then Response.Write "<br>"
                ' Or if you wanted to display simply each image name, uncomment this next line
                'Response.Write fsoFile.Name & "<br>"
            End If
        Next
    Else
        Response.Write("Folder " & strPath & " does not exist.")
    End If
    Set fso=nothing
    Set fsoFolder=nothing
End If
%>

</body>
</html>


Hasta Luego..
KingRoon

DogFightClothing. No dogs. No fighting.

http://www.dogfightclothing.com