Problem writing to files.

Results 1 to 3 of 3

Thread: Problem writing to files.

  1. #1
    Join Date
    Dec 1969

    Default Problem writing to files.

    I have been working on a website recently and I wrote a script to write to a file. Only thing is, once I write to the file, I cannot find the file once I write to it. Here is the code.<BR><BR>&#060;%@ Language=VBScript %&#062;<BR><BR>&#060;%<BR><BR><BR>Const fsoForWriting = 2<BR><BR>Dim objFSO<BR>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>&#039Open the text file<BR>Dim objTextStream<BR>Set objTextStream = objFSO.OpenTextFile("", fsoForWriting, TRUE)<BR><BR>&#039Display the contents of the text file<BR>objTextStream.WriteLine "Hello, World"<BR>objTextStream.WriteLine "This is fun!!"<BR><BR>&#039Close the file and clean up<BR>objTextStream.Close<BR>Set objTextStream = Nothing<BR>Set objFSO = Nothing<BR><BR>%&#062;<BR><BR>The system that hosts my website uses Cobalt Raq under an NT platform. I am not getting any error when I run the script, yet I cannot find the file Thanks for your help.<BR>

  2. #2
    Igal Vorobeychik Guest

    Default You should know Phisical Path here is some example

    Dim mfsobj<BR> Dim mfilobjLogFile<BR> &#039Declare file access constants<BR> Const ForAppending = 8<BR> Const TristateFalse = 0<BR>&#039write to log file<BR>&#039Instantiate the FileSystemObject variable<BR>Set mfsobj= server.CreateObject("Scripting.FileSystemObject")< BR>&#039Using OpenTextFile method of mfsobj to initialize the File <BR>&#039Object<BR>Set mfilobjLogFile = mfsobj.OpenTextFile(Application&_<BR>("PhisicalPat h"&"/log/"&mstrLogFileName&".log",&_<BR>ForAppending,true,T ristateFalse) <BR>&#039Write string plus newLine character to the end of opened file<BR>mfilobjLogFile.WriteLine "some log text"<BR>mfilobjLogFile.Close<BR>Set mfilobjLogFile = nothing<BR>Set mfsobj= nothing

  3. #3
    Igal Vorobeychik Guest

    Default Use ServerVariables to get your PhisicalPath

    Try this because I&#039m not shure about this Request.ServerVariables("PATH_TRANSLATED")

Posting Permissions

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