Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 22
  1. #1

    FSO lento a caricare la pagina...

    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(theFolderExclude)
    Dim rsFSOobjFSOobjFolderFile
      
    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.Name1)) <> 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 neededbut 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
    %> 
    My simple Script Asp: VotoMedio

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Non è che ti sembra... è così!
    Il limite non l'hai messo nella creazione del recordset disconnesso ma nella stampa dello stesso, dopo che si è caricato il mondo...

    Roby

  3. #3
    infatti Roby!

    mi aiuteresti a mettere il limite... nei select database ci riesco ma qui non so proprio come metterlo... questo "TOP 15"

    My simple Script Asp: VotoMedio

  4. #4
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Usa un contatore all'interno di.

    For Each File In objFolder.Files

    Roby

  5. #5
    ho provato diversi modo tra cui:

    Codice PHP:
    dim contatore
    For contatore 0 To 10
      
    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
      Next 
    ma nulla!

    mi sento alquanto...
    My simple Script Asp: VotoMedio

  6. #6
    dim conta
    conta=0
    for each
    conta=conta+1
    if conta>15 then exit for
    next

    capoccia accesa e via

  7. #7
    ma sai che facendo così:

    Codice PHP:
      dim conta 'Nuovo per contare files
      conta=0 '
    Nuovo per contare files
      
      
    'Now let's find all the files in the folder
      
    For Each File In objFolder.Files

      conta
    =conta+'Nuovo per contare files
      if conta>15 then exit for '
    Nuovo per contare 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 
    Mi funziona!

    beato il giorno che saprò fare qualcosa da solo!

    Penso che ora sia corretta... e se non fosse per voi starei sempre avanti al monitor a

    TKS!
    My simple Script Asp: VotoMedio

  8. #8
    la if con l'exit for la metterei dentro la if degli esclusi, altrimenti nei 15 ti conta anche gli esclusi

  9. #9
    si devo modificare, perchè tra l'altro non mi fa vedere più per ordine di data ma soltanto i primi 15... per la gioia di condividere... ho visto il risultato ma non ho visto i dati...

    ma adesso devo chiudere tutto!

    domani aggiorno il topic spero con buone nuove!

    sperem...
    My simple Script Asp: VotoMedio

  10. #10
    ho messo o meglio penso di aver messo come mi hai detto tu:

    Codice PHP:
    dim conta 'Nuovo per contare files
      conta=0 '
    Nuovo per contare files

      
    'Now let's find all the files in the folder
      
    For Each File In objFolder.Files

      conta
    =conta+'Nuovo per contare files
      

        '
    hide any file that begins with the character to exclude
        
    If (Left(File.Name1)) <> Exclude Then 
    if conta>15 then exit for 'Nuovo per contare files
          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 
    solo che adesso c'è un altro problema... mi escono in ordine diverso... ovvero non più per ultimo file creato, ma in un ordine che non ho ancora capito...
    My simple Script Asp: VotoMedio

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.