Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 25

Discussione: Visualizzazione files

  1. #1

    Visualizzazione files

    ho uno script che mi permette di visualizzare i files presenti in una cartella.

    Ora a me servirebbe la possibilità di:
    1)escludere i files inseriti in data corrispondente al giorno in cui si visita la pagina. Per intenderci.. se oggi visito la pagina, mi dovrebbe mostrare tutti i files, esclusi quelli inseriti oggi(o nell'ultima settimana).

    2)l'opposto del punto 1. Ossia visualizzare solo i files inseriti "oggi" o "nell'ultma settimana".

    Cosa devo aggiungere??


    Grazie mille.

  2. #2
    mi sono dimenticato di dire che questo script non usa database.

  3. #3
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    Vuoi fare il controllo sulla data di modifica o di creazione del file ?
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  4. #4
    Lo script che ho io visualizza in una tabella i files. In questa tabella viene anche mostrata una data per ogni file. Tale data corrisponde esattamente al giorno in cui il files è stato inserito nella cartella.
    Quindi di sicuro non è la data di creazione del file.

    E' la data di modifica del file.

  5. #5
    Devi usare la proprietà DateCreated dell'oggetto file system

  6. #6
    mmmm... non so programmare io...
    cmq grazie.. ora faccio una ricerca su ciò

  7. #7
    altrimenti se posti il codice che usi magari qualcuno che te lo modifica lo trovi... così è impossibile aiutarti. certo se riesci da solo è la strada migliore

    Ciao

  8. #8
    Ecco il codice....:

    <%
    Response.Buffer = True
    Response.Expires = 0
    SetLocale(1040)
    root = "okocha_files"
    chiave = "F"
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html>
    <head>
    <title>Files (chiave)</title>
    <style>
    th{background-color: silver;}
    td{background-color: white; text-align:center;}
    body, th, td{font-size: 82%; font-family:verdana;}
    a{text-decoration: none; color: #333333;}
    a:hover{text-decoration:underline; color:red;}
    </style>
    </head>

    <body>
    <%
    Set FSO = Server.CreateObject("scripting.filesystemobject")

    Set Listato = Server.CreateObject("adodb.recordset")
    Listato.Fields.Append "id", 3
    Listato.Fields.Append "nome", 129, 200
    Listato.Fields.Append "dimensione", 3
    Listato.Fields.Append "data", 7
    Listato.Open

    Set Cartella = FSO.GetFolder(Server.MapPath(root))

    For Each File In Cartella.Files
    Ext = Right(File.Name,3)
    If Ext = "zip" OR Ext = "exe" OR Ext = "rar" OR Ext = "txt" Then
    If UCase(Left(File.Name, Len(Chiave))) = UCase(Chiave) Then
    I = I +1
    Listato.AddNew
    Listato("Id") = I
    Listato("Nome") = File.Name
    Listato("Dimensione") = File.Size / 1024
    Listato("Data") = FormatDateTime(File.DateLastModified,2)
    End If
    End If
    Next
    Set Cartella = Nothing
    If Listato.EOF = False Then
    Listato.Sort = "nome"
    Listato.MoveFirst
    %>
    <table cellpadding="3" cellspacing="1" bgcolor="gray" width="600">
    <tr>
    <th width="5%"></th>
    <th width="55%">Nome</th>
    <th width="20%">Dimensione</th>
    <th width="20%">Data</th>
    </tr>
    <% For I = 1 To Listato.RecordCount%>
    <tr>
    <td><%=I%></td>
    <td style="text-align:left;">
    <a href="window.asp?file=<%=Listato("nome")%>" target="_blank">
    <%=Spazio(Listato("Nome"))%></a></td>
    <td><%=FormatNumber(Listato("Dimensione"),0)%> Kb</td>
    <td><%=Listato("Data")%></td>
    </tr>
    <%Listato.MoveNext
    Next%>
    </table>

    <%
    End If
    Listato.Close
    Set Listato = Nothing
    Set FSO = Nothing
    %>


    </body>
    </html>

  9. #9

    Con questo escludi tutti i file generati oggi

    Set Cartella = FSO.GetFolder(Server.MapPath(root))

    For Each File In Cartella.Files
    If File.DateCreated < date then
    Ext = Right(File.Name,3)
    If Ext = "zip" OR Ext = "exe" OR Ext = "rar" OR Ext = "txt" Then
    If UCase(Left(File.Name, Len(Chiave))) = UCase(Chiave) Then
    I = I +1
    Listato.AddNew
    Listato("Id") = I
    Listato("Nome") = File.Name
    Listato("Dimensione") = File.Size / 1024
    Listato("Data") = FormatDateTime(File.DateCreated,2)
    End If
    End If
    Next
    Set Cartella = Nothing
    If Listato.EOF = False Then
    Listato.Sort = "nome"
    Listato.MoveFirst
    %>
    <table cellpadding="3" cellspacing="1" bgcolor="gray" width="600">
    <tr>
    <th width="5%"></th>
    <th width="55%">Nome</th>
    <th width="20%">Dimensione</th>
    <th width="20%">Data</th>
    </tr>
    <% For I = 1 To Listato.RecordCount%>
    <tr>
    <td><%=I%></td>
    <td style="text-align:left;">
    <a href="window.asp?file=<%=Listato("nome")%>" target="_blank">
    <%=Spazio(Listato("Nome"))%></a></td>
    <td><%=FormatNumber(Listato("Dimensione"),0)%> Kb</td>
    <td><%=Listato("Data")%></td>
    </tr>
    <%
    End if
    Listato.MoveNext
    Next%>

  10. #10
    Mi da il seguente errore:

    Microsoft VBScript compilation error '800a041f'

    Unexpected 'Next'

    /public/okochakey.asp, line 48

    Next
    ^

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.