Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > List Image by date in ASP

Reply
Thread Tools

List Image by date in ASP

 
 
Sylvian Tam
Guest
Posts: n/a
 
      10-11-2003
Hi all,

I am using the File System Object to get a list of image through a specified
local path :

Dim fso, ffolder, ffile, fc, fproperity, strOut, strPic
Set fso = CreateObject("Scripting.FileSystemObject")
Set ffolder = fso.GetFolder(folderspec)
Set fc = ffolder.Files

For Each ffile in fc
intCount = intCount + 1
strPic = strPhotoPath & ffile.name
Set fproperity = fso.GetFile(strPic)

'show image one by one...

Next


I found that the image will be display by file name by default, is there any
way to show them by the created date or last accessed date?

Is there any way in doing this?

Thanks
Sylvian


 
Reply With Quote
 
 
 
 
Manohar Kamath [MVP]
Guest
Posts: n/a
 
      10-11-2003
As you loop through the files, create a recordset with file name and file
date. Then you can sort this recordset however you want.

' Create a custom recordset
Set filesRs = Server.CreateObject("ADODB.RecordSet")
filesRs.CursorLocation = 3 ' adUseClient
filesRs.Fields.Append "FileDate", adDate
filesRs.Fields.Append "FileName", adVarChar, 255
filesRs.Open

For Each ffile in fc
intCount = intCount + 1
strPic = strPhotoPath & ffile.name

...
filesRs.AddNew
filesRs("FileDate") = CDate(ffile.CreateDate) ' Check the property

filesRs("FileName") = CStr(ffile.Name) ' Check the property

Loop

' Sort the recordset on FileDate and proceed
filesRs.Sort = "FileDate ASC"

Hope that helps.

--
Manohar Kamath
Editor, .netBooks
www.dotnetbooks.com


"Sylvian Tam" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi all,
>
> I am using the File System Object to get a list of image through a

specified
> local path :
>
> Dim fso, ffolder, ffile, fc, fproperity, strOut, strPic
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set ffolder = fso.GetFolder(folderspec)
> Set fc = ffolder.Files
>
> For Each ffile in fc
> intCount = intCount + 1
> strPic = strPhotoPath & ffile.name
> Set fproperity = fso.GetFile(strPic)
>
> 'show image one by one...
>
> Next
>
>
> I found that the image will be display by file name by default, is there

any
> way to show them by the created date or last accessed date?
>
> Is there any way in doing this?
>
> Thanks
> Sylvian
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP General 11 11-08-2003 11:24 PM
Given a date, how to find the beginning date and ending date of that week Matt ASP .Net 1 11-08-2003 09:14 PM
Given a date, how to find the beginning date and ending date of that week Matt C Programming 3 11-08-2003 09:07 PM
Given a date, how to find the beginning date and ending date of that week Matt C++ 2 11-08-2003 08:30 PM



Advertisments