CreateTextFile (Scripting.FileSystemObject) !

Results 1 to 3 of 3

Thread: CreateTextFile (Scripting.FileSystemObject) !

  1. #1
    Martin, Sweden Guest

    Default CreateTextFile (Scripting.FileSystemObject) !

    Hey guys!<BR><BR>I need som help with creating a text file on the server, with a different name for every user who submit my orders!<BR><BR>I want to use the command Now(), to make every new file created, named with the exact date, time and with the file end .txt!<BR>I request a form from another asp doc!<BR>The Request.Form("Fil") contains for example this: ("1999-09-17 18:31:11.txt")<BR><BR>Now I want to use the variable fil and put it after the Server.MapPath dir best/!<BR>But I can´t get it to work!<BR><BR>I tried this:<BR><BR>Set ts = fso.CreateTextFile(Server.MapPath("best/&#039" & fil & "&#039"), True)<BR><BR>But it didn´t work!<BR><BR><BR>Here is how the original code looks like, and it works fine!<BR><BR><BR>&#060;html&#062;<BR>&#060;head&#0 62;<BR>&#060;/head&#062;<BR><BR>&#060;%<BR>Dim kundID, namn, epost, adress, postadress, postnummer, telefon, fil<BR>kundID = Request.Form("KundID")<BR>namn = Request.Form("Namn")<BR>epost = Request.Form("Epost")<BR>adress = Request.Form("Adress")<BR>postadress = Request.Form("Postadress")<BR>postnummer = Request.Form("Postnummer")<BR>telefon = Request.Form("Telefon")<BR>fil = Request.Form("Fil")<BR><BR>Dim fso, ts<BR>Set fso = Server.CreateObject("Scripting.FileSystemObject")< BR>Set ts = fso.CreateTextFile(Server.MapPath("best/test.txt"), True)<BR>ts.WriteLine("Order")<BR>ts.WriteLine(kun dID)<BR>ts.WriteLine(namn)<BR>ts.WriteLine(epost)< BR>ts.WriteLine(adress)<BR>ts.WriteLine(postadress )<BR>ts.WriteLine(postnummer)<BR>ts.WriteLine(tele fon)<BR>ts.Close<BR><BR>Set fso = Nothing<BR>Set ts = Nothing<BR>%&#062;<BR><BR>&#060;body&#062;<BR>Than ks!<BR>&#060;/body&#062;<BR>&#060;/html&#062;<BR><BR><BR><BR>I´m really greatful if you can help me!<BR><BR>Thanks<BR>Martin, Sweden<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    915

    Default RE: CreateTextFile (Scripting.FileSystemObject) !

    No 100% sure, but I think the problem you are having is due to the &#039 (single quotes) you have before and after the & file &.<BR><BR>Hope this is it, and Good Luck.<BR><BR>Jerry

  3. #3
    Thanks Jerry! Guest

    Default RE: CreateTextFile (Scripting.FileSystemObject) !

    The problem was that I used Now() wich made values that was not valid!<BR><BR>filename was this: (1999-09-19 14:23:13.txt)<BR>The invalid values was ":" in the time string!<BR><BR>Thanks anyway!<BR>Martin, Sweden

Posting Permissions

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