开发者

latest image upload asp.net 2.0 applet

I use the following coding to show six images from the latest photo album i uploaded picture to. However the images being shown are the 1st six images in the folder (which are the ones the oldest uploaded) not the final six images uploaded. Anyone can help me what should i change in the following coding to show the last six images in the folder.

               <%
                            latestfolder = "na"
                            latestdate = cdate("01/01/09")

                            set fs=Server.CreateObject("Scripting.FileSystemObject")
                    set fo=fs.GetFolder(Server.MapPath("images/gallery"))
                            for each folder in fo.subfolders 
                                if cdate(folder.DateLastModified) > latestdate then
                                    latestdate = cdate(folder.DateLastModified)
                                    latestfolder = folder.name
                                end if
                            next

                            if latestfolder <> "na" then
                              set fi=fs.GetFolder(Server.MapPath("images/gallery/" & latestfolder))
 开发者_如何学Python                               looptimes = 0
                                for each file in fi.files 

    if right(lcase(file.Name),3) = "jpg" then %>

 <a href="thumbnail.aspx?picture=<%=server.URLEncode("images/gallery/" & latestfolder & "/" & file.Name)%>&maxWidth=640&maxHeight=480" target="_blank"  style="text-decoration:none; cursor:pointer;">          
   <img src="thumbnail.aspx?picture=<%=server.URLEncode("images/gallery/" & latestfolder & "/" & file.Name)%>&maxWidth=100&maxHeight=60" style="border:1px solid #ffffff; margin:5px; margin-top:14px;">        </a> 

  <% end if

                                    looptimes = looptimes + 1
                                    if looptimes = 6 then exit for end if
                                next

                            end if
                    %>


Yuck! With that said...it looks like you are sorting your folders based on date, but not your files.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜