FSO ile klasördeki resimleri listelemek

ontedi

New member
<%
strListelenecekKlasor = "avatar" 'Listelenecek olan klasörün adı
Set ObjFSO=Server.CreateObject("Scripting.FileSystemObject")
Set strDosyalar=ObjFSO.GetFolder(Server.MapPath(strListelenecekKlasor))
RSayisi = strDosyalar.Files.Count - 1
response.write ""&RSayisi&"<hr>"
if RSayisi > "0" then
For each strBulunanDosya in strDosyalar.files
if right(strBulunanDosya.Name,"3") = "gif" OR right(strBulunanDosya.Name,"3") = "GIF" OR right(strBulunanDosya.Name,"3") = "JPG" OR right(strBulunanDosya.Name,"3") = "jpg" OR right(strBulunanDosya.Name,"4") = "jpeg" OR right(strBulunanDosya.Name,"4") = "JPEG" OR right(strBulunanDosya.Name,"3") = "png" OR right(strBulunanDosya.Name,"3") = "PNG" OR right(strBulunanDosya.Name,"3") = "BMP" OR right(strBulunanDosya.Name,"3") = "bmp" THEN
Response.Write strBulunanDosya.Name & " ( " & strBulunanDosya.size & " Byte )<br>"
Response.Write "<img src='"&strListelenecekKlasor&"/"&strBulunanDosya.Name&"'>"
end if
Next
end if
'http://serkan.teorik.net
%>


Ek olarak dosyaların adlarını ve boyutlarınıda yanlarına yazdırdım, eğer onları istemiyorsanız

Response.Write strBulunanDosya.Name & " ( " & strBulunanDosya.size & " Byte )<br>" satırını silin. Güle güle kullanın.
Not: Alıntı değil, alınteri.
 

HTML

Üst