Solved

Reading  a  text file from ASP

Posted on 1999-01-29
4
172 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
  • 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Centering Vertically 3 34
HTML Relative path 9 32
Browser Chrome downloads colored link 5 40
Little bit of help styling my heading 3 17
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

785 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