Reading a text file from ASP

Dear Friends
     Can I read a text file from my ASP
I have to take each string from the file till the EOF.
I need ASP code with explanation
jimevansAsked:
Who is Participating?
 
MasseyMCommented:
<%
  Dim fso, f, f1, fc, s
  Set fso = CreateObject("Scripting.FileSystemObject")
      TheFile = Server.MapPath(Request.ServerVariables("SCRIPT_NAME"))
      loc = InStrRev(TheFile,"\")
      TheFile = Left(TheFile,loc)
  Set f = fso.GetFolder(TheFile)
  Set fc = f.Files
%>
<%
Set TitleFile = fso.OpenTextFile(TheFile & "yourfile.txt")
TextBuffer = TitleFile.ReadAll
TitleFile.Close
%>


this will read the entire file into the "TextBuffer" variable.
0
 
martinagCommented:
Why did you delete "Getting a value from a listbox"? Because my solution worked?

Martin
0
 
jimevansAuthor Commented:
Thanks MasseyM
your code works good

Martin I have already tried the ways you have
sugessted before I posted that question. Then used a different method to solve that problem. Please dont feel bad in this issue
0
 
martinagCommented:
Just being curious...How did you do?

Martin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.