Print Page | Close Window

Show Images from a Directory!!!

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6493
Printed Date: 31 March 2026 at 3:06pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Show Images from a Directory!!!
Posted By: mzeb
Subject: Show Images from a Directory!!!
Date Posted: 17 October 2003 at 1:43am

Dear Friends!!!!

Please i need a script which will show images from the directory eg: if i have emoticons in the directory, can u please tell me how can i make a ASP file with which it will display all the images from the directory! so if i upload a image it will be automaticlly there!

best wishes

 




Replies:
Posted By: MorningZ
Date Posted: 17 October 2003 at 7:12am

http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=90 - http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=90

With one little twist

<%
  'Create the FileSystemObject object
  Dim objFSO
  Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

  'Obtain an folder object instance for a particular directory
  Dim objFolder
  Set objFolder = objFSO.GetFolder("C:\FooBar\Blah\")

  'Use a For Each ... Next loop to display the files
  Dim objFile, FileName, Ext
  For Each objFile in objFolder.Files
     FileName = Mid(objFile.Path,InstrRev(objFile.Path,"\")+1)
     Ext = Right(FileName,4)
     if (Ext=".jpg") or (Ext=".gif") or (Ext=".png") then
          Response.Write FileName & "<br />"
     end if
  Next
%>



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: mzeb
Date Posted: 18 October 2003 at 3:48am

Thanks alot!!!!!!!!!!!!!!!!!!!!!

MorningZ Thanks

it working here



Posted By: mzeb
Date Posted: 18 October 2003 at 4:30am

Dear! MorningZ

its shows just the file names, can u tell me how it will display the images of the directory! !!!!!!!!

please if u do this so i will be very thanksful......



Posted By: MorningZ
Date Posted: 18 October 2003 at 8:50am

c'mon man.. thats as simple as it gets... you have to spend some effort on your own

you'd change:
Response.Write FileName & "<br />"

to:
Response.Write "<img src=""" & FileName & """><br />"



-------------
Contribute to the working anarchy we fondly call the Internet


Posted By: mzeb
Date Posted: 18 October 2003 at 9:15am

Dear MorningZ!!!!

Thanks alot again!!!!!

Can u teach me how to do this one:::

if i have a file let name it 'file.asp' if i have 1 another file 'file2.asp' so,

How should i attach this file to file1.asp, i like this:

file1.asp?page=2 if i enter this so how will it load the file2.asp?????

I m waiting for Reply! 




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net