Utilizzo questo script, per visualizzare il contenuto della cartella ovvero i primi 15 files...
solo che non avendo messo un "TOP 15" mi sembra che prima lo script mi legga tutti i files e poi mi escono solo i primi 15... facendo in modo da aver un caricamento della pagina molto lento... dove posso inserire l'eventuale "TOP 15" affinchè la pagina sia più veloce?
tks!
Codice PHP:<%
Function kc_fsoFiles(theFolder, Exclude)
Dim rsFSO, objFSO, objFolder, File
Const adInteger = 3
Const adDate = 7
Const adVarChar = 200
'create an ADODB.Recordset and call it rsFSO
Set rsFSO = Server.CreateObject("ADODB.Recordset")
'Open the FSO object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'go get the folder to output it's contents
Set objFolder = objFSO.GetFolder(theFolder)
'Now get rid of the objFSO since we're done with it.
Set objFSO = Nothing
'create the various rows of the recordset
With rsFSO.Fields
.Append "Name", adVarChar, 300
.Append "Type", adVarChar, 200
.Append "DateCreated", adDate
.Append "DateLastAccessed", adDate
.Append "DateLastModified", adDate
.Append "Size", adInteger
.Append "TotalFileCount", adInteger
End With
rsFSO.Open()
'Now let's find all the files in the folder
For Each File In objFolder.Files
'hide any file that begins with the character to exclude
If (Left(File.Name, 1)) <> Exclude Then
rsFSO.AddNew
rsFSO("Name") = File.Name
rsFSO("Type") = File.Type
rsFSO("DateCreated") = File.DateCreated
rsFSO("DateLastAccessed") = File.DateLastAccessed
rsFSO("DateLastModified") = File.DateLastModified
rsFSO("Size") = File.Size
rsFSO.Update
End If
Next
rsFSO.Sort = "DateCreated DESC"
'Now get out of the objFolder since we're done with it.
Set objFolder = Nothing
'now make sure we are at the beginning of the recordset
'not necessarily needed, but let's do it just to be sure.
rsFSO.MoveFirst()
Set kc_fsoFiles = rsFSO
End Function
'Now let's call the function and open the recordset on the page
'the folder we will be displaying
Dim strFolder : strFolder = Server.MapPath("\public\press_img\")
'the actual recordset we will be creating with the kc_fsoFiles function
Dim rsFSO 'now let's call the function and open the recordset
'we will exclude all files beginning with a "_"
Set rsFSO = kc_fsoFiles(strFolder, "_")
Dim Repeat1__numRows
Dim Repeat1__index
Repeat1__numRows = 15
Repeat1__index = 0
rsFSO_numRows = rsFSO_numRows + Repeat1__numRows
%>
<html>
<head>
<title>MultiUpload</title>
</head>
<body bgcolor="#EEEEEE" marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table width="100%" border="0" cellpadding="3" cellspacing="1" style="background-color: #F7F7F7; border: 2px solid #FFFFFF; padding: 5px;">
<tr>
<td colspan="4" align="center">[b]ULTIMI 15 FILES INSERITI[/b]</td>
</tr>
<tr>
<td>[b]Nome File:[/b] [i]<font color="#CC0000">Copiare il percorso completo</font>[/i]</td>
<td width="110" align="center">[b]Tipologia File:[/b]</td>
<td width="80" align="center">[b]Dimens:[/b]</td>
<td width="80" align="center">[b]Data[/b]</td>
</tr>
<%
While ((Repeat1__numRows <> 0) AND (NOT rsFSO.EOF))
%>
<tr>
<td>[url="/public/press_img/<%= rsFSO("]" target="_blank">/public/press_img/<%= rsFSO("Name").Value %>[/url]</td>
<td align="center"><%=rsFSO("Type")%></td>
<td align="center"><%Response.Write round(rsFSO("Size")/1000)%> kb</td>
<td width="100" align="center">[i]<%=rsFSO("DateCreated")%>[/i]</td>
</tr>
<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
rsFSO.MoveNext()
Wend
%>
</table>
<%
'finally, close out the recordset
rsFSO.close()
Set rsFSO = Nothing
%>

Rispondi quotando

