Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jun 2007
    Messaggi
    76

    importare txt in una pagina

    sarà una domanda cretina ma che non so,

    mi potete dire se è possibile importare un testo txt in una pagina html utilizzando uno script....??

    grazie in anticipo


  2. #2
    Certo.
    codice:
    <%
    pagina = "/sample/pagina.txt"
    
    function leggiTXT(path)
      if len(pagina) > 0 then
        set fso = server.createObject("Scripting.FileSystemObject")
          if fso.fileExists(server.mapPath(path)) then
            set file = fso.openTextFile(server.mapPath(path))
              content = file.readAll
              if len(content) > 0 then content = replace(content,vbCrLf,"
    ")
              response.write content
            set file = nothing
          else
            response.write "Impossibile trovare il file: " & path & "
    "
          end if
        set fso = nothing
      else
        response.write "Nessun file da leggere specificato
    "
      end if
    end function
    %>
    <html>
      <head>
        <title>Titolo</title>
      </head>
      <body>
        <% call leggiTXT(pagina) %>
      </body>
    </html>

  3. #3
    Utente di HTML.it
    Registrato dal
    Jun 2007
    Messaggi
    76
    grazie mille

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 © 2026 vBulletin Solutions, Inc. All rights reserved.