Results 1 to 2 of 2

Thread: Script Question (Script Enclosed)

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    usa
    Posts
    10

    Exclamation

    How can I get this script to save the file with the days date and time as the name. and help would be appreciated.
    Thanks

    Script:
    ==================================================
    <%
    Dim filesys, txtfile
    Set filesys = CreateObject("Scripting.FileSystemObject")
    Set txtfile = filesys.CreateTextFile("C:\test.txt", true)

    dim item
    for each item in Request.Form
    txtFile.WriteLine (Request.Form (item))
    next
    txtfile.close 'close the file
    set txtFile = nothing


    %>
    ===========================================================


  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Try this
    Code:
    <% 
    Dim filesys, txtfile
    Dim strFile 'hold filename to write to
    strFile = Now 'get current date and time
    strFile = Replace(str, "/", "-") 'get rid of unacceptable
    strFile = Replace(str, ":", "-") 'characters
    
    Set filesys = CreateObject("Scripting.FileSystemObject") 
    Set txtfile = filesys.CreateTextFile(strFile, true) 'use strFile as the file path
    
    dim item 
    for each item in Request.Form 
    txtFile.WriteLine (Request.Form (item)) 
    next 
    txtfile.close 'close the file 
    set txtFile = nothing 
    
    
    %>
    Hope this helps

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width