|
-
Aug 16th, 2000, 11:17 AM
#1
Thread Starter
Hyperactive Member
Can anyone tell me how to very very very simply open a file from the web server.. ie: openning "myfile.txt" when a HTML file is viewed.
<HTML>
<HEAD><TITLE>My File</TITLE></HEAD>
<H1><B>ASP Script</B></H1>
<BODY>
<BR>
<HR>
<% code to open a file %>
<BR>
<% Next %>
<HR>
</BODY>
</HTML>
Many Thanks
-
Aug 17th, 2000, 03:45 AM
#2
Thread Starter
Hyperactive Member
format
What if i wanted to format the output somewhat?
Regards Gary
-
Aug 17th, 2000, 12:50 PM
#3
Monday Morning Lunatic
Try using the Open statement, as in a normal VB program.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 17th, 2000, 02:23 PM
#4
Lively Member
Use CSS.
Or you could use <style></style> tags before and after you open the text file. Just insert the style sheet attributes in the first tag.
-
Aug 17th, 2000, 02:26 PM
#5
Monday Morning Lunatic
SSI doesn't care about formatting, it just expands it in-place, so using CSS like that would work. If you want to format the individual parts of the file, then you'd have to open it yourself using ASP. My SSI method was THE simplest way imaginable...
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 18th, 2000, 04:36 AM
#6
Thread Starter
Hyperactive Member
use VB
I would like to use VB to open a file and display it line by line wrapped in ASP tags
<% vb code %>
Can you show me how this is done to understand the declarations needed for the web.?
Many Thanks
-
Aug 18th, 2000, 07:39 AM
#7
Lively Member
You use the FileSystem Object to open and read files.
Here's some sample code using the object:
http://msdn.microsoft.com/scripting/...gfsosample.htm
-
Aug 18th, 2000, 09:41 AM
#8
Thread Starter
Hyperactive Member
whaaaaooh
**** me.. surely i dont need all that?
-
Aug 18th, 2000, 10:22 AM
#9
Lively Member
To read the file you should only need the following:
Code:
Function GetLyrics(FSO)
Dim TextStream
Dim S
Dim File
' There are several ways to open a text file, and several
' ways to read the data out of a file. Here's two ways
' to do each:
Set TextStream = FSO.OpenTextFile(TestFilePath & "\Beatles\OctopusGarden.txt", OpenFileForReading)
S = TextStream.ReadAll & NewLine & NewLine
TextStream.Close
Set File = FSO.GetFile(TestFilePath & "\Beatles\BathroomWindow.txt")
Set TextStream = File.OpenAsTextStream(OpenFileForReading)
Do While Not TextStream.AtEndOfStream
S = S & TextStream.ReadLine & NewLine
Loop
TextStream.Close
GetLyrics = S
End Function
Make sure you declare the constants (OpenFileForReading, etc) or if you don't want to declare them just use the constant's value in the method calls.
[Edited by ttingen on 08-18-2000 at 11:28 AM]
-
Aug 21st, 2000, 04:20 AM
#10
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|