Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 11th, 2006, 09:17 AM
Registered User
 
Join Date: Jun 2006
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default display pictures from directory

Hi,
I want to create asp form.
the input would be path of directory
the output would be table containing all the gif's in the directory

any idea how to do that? resource?
Thanks

Janiv
  #2 (permalink)  
Old June 12th, 2006, 05:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: High Wycombe, UK, United Kingdom.
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

your best bet is to use the File Scripting Object (FSO) to process the directory in question and then have the ASP display all the images, and only images, found there in in a HTML output either using a table or some CSS DIV type display.
  #3 (permalink)  
Old June 14th, 2006, 01:20 AM
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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to display pictures on JSP page? coitri JSP Basics 19 November 24th, 2008 06:22 AM
How to display pictures on JSP page? Kisat JSP Basics 1 November 3rd, 2008 09:02 PM
Display many pictures NBM Java GUI 0 September 3rd, 2006 06:54 AM
display pictures from directory chetrity Classic ASP Basics 1 June 15th, 2006 01:01 PM



All times are GMT -4. The time now is 10:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.