Solved

Reading  a  text file from ASP

Posted on 1999-01-29
4
192 Views
Last Modified: 2010-04-09
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
0
Comment
Question by:jimevans
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
MasseyM earned 20 total points
ID: 1845822
<%
  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
 
LVL 4

Expert Comment

by:martinag
ID: 1845823
Why did you delete "Getting a value from a listbox"? Because my solution worked?

Martin
0
 

Author Comment

by:jimevans
ID: 1845824
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
 
LVL 4

Expert Comment

by:martinag
ID: 1845825
Just being curious...How did you do?

Martin
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question