Vis flere af de nyeste billeder (har kode til at vise det nyeste)
Hej Eksperter.Jeg har følgende kode, som viser det nyest uploadede billed i en af undermapperne til en defineret mappe, men jeg vil nu gerne have vist de 5 nyeste i stedet for kun det ene.
---------------------------------------------------
<%Set fso = CreateObject("Scripting.FileSystemObject")
fileDate = ""
fileName = ""
filePath = ""
function saveFiles (foldernavn)
Set objFolder = fso.getFolder( foldernavn )
Set objFiles = objFolder.Files
for each file in objFiles
if instr(1,"bmp,gif,jpg,png,jpeg,tif",lcase(fso.GetExtensionName(file.name)))>0 then
if isDate(fileDate) then
if CDate(file.DateLastModified) > CDate(fileDate) then
fileDate = file.DateLastModified
fileName = file.name
filePath = file.Path
end if
else
fileDate = file.DateLastModified
fileName = file.name
filePath = file.Path
end if
end if
next
For each Folder in objFolder.SubFolders
call saveFiles (Folder.path)
next
Set objFolder = Nothing
Set objFiles = Nothing
end function
relativSti = "/upload/downloads/billed"
strPhysicalPath = Server.MapPath(relativSti)
Set objFolder = fso.getFolder( strPhysicalPath )
For each Folder in objFolder.SubFolders
call saveFiles (folder.Path)
next
sti = replace(filePath,Server.MapPath("/"),"",1,-1,1)
sti = replace(sti,"\","/")
Response.Write "<a title=""Vis billed i stort format i galleriet"" href=""gallery.asp?ShowPic=" & sti & """><img
src=""" & sti & """ width=""120"" height=""120"" border=""0""></a>"
Set objFolder = Nothing
Set fso = Nothing%>
---------------------------------------------------
Håber I kan hjælpe mig og på forhånd tak.
W13