FileSystemObject question

Results 1 to 3 of 3

Thread: FileSystemObject question

  1. #1
    muddMuse Guest

    Default FileSystemObject question

    I&#039m simply trying to read a .txt file and its not getting found even though I&#039m absolutely sure its in the root directory. I&#039ve tried putting in the complete url as well as the relative path and get the same thing. Do you see any problems here?<BR><BR>Dim objFSO<BR>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>Dim objTextStream<BR><BR>const strFileName = "PageTotals.txt"<BR>const fsoForReading = 1<BR><BR>If objFSO.FileExists("PageTotals.txt") then<BR> &#039The file exists, so open it and output its contents<BR> Set objTextStream = objFSO.OpenTextFile(strFileName, fsoForReading)<BR> Response.Write "" & objTextStream.ReadAll & ""<BR> objTextStream.Close<BR> Set objTextStream = Nothing<BR>Else<BR> &#039The file did not exist<BR> Response.Write strFileName & " was not found."<BR>End If<BR><BR>&#039Clean up<BR>Set objFSO = Nothing

  2. #2
    Join Date
    Dec 1969

    Default RE: FileSystemObject question

    Try using:<BR>Const strFileName = "C:PageTotals.txt"<BR><BR>And make sure that the internet user must have access to C: .<BR>I won&#039t recommend that, however, for security reasons...

  3. #3
    Thomas Whalen Guest

    Default RE: FileSystemObject question

    are you sure you can use a Response.Write to write out a method? i don&#039;t think that can be done. try setting the results of the foo.WriteAll method to a variable, THEN write out the variable. that should solve your problem. but, since that was two months ago you have probably solved this. alas, this might help someone else.<BR><BR>take care,<BR><BR>Thomas<BR> m

Posting Permissions

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