[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

ASP Display folder contents

Posted on 2009-04-30
2
Medium Priority
?
267 Views
Last Modified: 2012-05-06
How do I adjust the code below to display in two columns?
<%
Dim oFilesys, oFolder, oFile
Set oFilesys= CreateObject("Scripting.FileSystemObject")
Set oFolder= oFilesys.GetFolder(Server.MapPath("/gallery/"))
For Each oFile in oFolder.Files
Response.write  "<img src=""/gallery/" & oFile.Name & """ width=""300"" />"
Response.write "<br />"
Next
 
Set oFolder=Nothing
Set oFilesys=Nothing
%>

Open in new window

0
Comment
Question by:wellsuited
  • 2
2 Comments
 
LVL 6

Accepted Solution

by:
DanielWillmott earned 2000 total points
ID: 24273762
Try this:
<%
Dim oFilesys, oFolder, oFile, x
Set oFilesys= CreateObject("Scripting.FileSystemObject")
Set oFolder= oFilesys.GetFolder(Server.MapPath("/gallery/"))
 
x=0
response.write "<table>"
 
For Each oFile in oFolder.Files
if x=0 then
     response.write "<tr>"
end if
response.write "<td>"
Response.write  "<img src=""/gallery/" & oFile.Name & """ width=""300"" />"
Response.write "</td>"
 
if x=1 then
     response.write "</tr>"
end if
x=1-x
Next
if x=1 then
     response.write "</tr>"
end if 
 
response.write "</table>"
 
Set oFolder=Nothing
Set oFilesys=Nothing
%>

Open in new window

0
 
LVL 6

Expert Comment

by:DanielWillmott
ID: 24273791
Actually..change line 13 to:
response.write "<td style='width:300px'>"

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question