asp顯示圖片信息

asp顯示圖片信息:

<%
Dim fso, f, f1, fc, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFolder(server.mapPath("../uploadfiles/")) ''uploadfiles爲你的圖片文件夾
  Set fc = f.Files
  For Each f1 in fc
    response.write f1.name
    response.write "<BR>"
  Next
  ShowFolderList = s

%>

 

asp顯示圖片並能刪除:

<%

myFolder="../uploadfiles/"

'''''''刪除刪除文件。
if request("act")="del" then
   Set fso = CreateObject("Scripting.FileSystemObject")
   set f2 = fso.GetFile(server.mapPath(myFolder & request("fname")))
   f2.Delete
   response.redirect("2.asp")    ‘2.asp的文件名爲此程序段的文件名
end if
Dim fso, f, f1, fc, s
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set f = fso.GetFolder(server.mapPath(myFolder)) ''uploadfiles爲你的圖片文件夾
  Set fc = f.Files
  For Each f1 in fc

    response.write "<img src="""&myFolder&f1.name &""" height=100 alt='"&f1.name&"'><a href='?act=del&fname="&f1.name&"'>刪除</a>"
    response.write "<BR>"
  Next
  ShowFolderList = s

%>




<%  Set fso = Server.CreateObject("Scripting.FileSystemObject") '建立FSO對象
 Set fd = fso.GetFolder(server.mappath("works"))
 tpath=server.mappath("./")
 i=1
 For each sfd In fd.SubFolders
  For each f In sfd.Files 
  s=f.path 
  s=replace(s,tpath&"\","")

response.write "文件:<img src=>"&s&"><br>"
 i=i+1
  Next
 Next
   
set fso=nothing%>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章