SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 18th, 2000, 09:34 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
displaying text files without using include file

<i><b>Originally posted by : cem tekin (tekin65@yahoo.com)</b></i><br />hi, i'm quite new to asp. i wonder if there's anybody who do have an answer to my problem.<br /><br />i'm trying to insert one of many text files into a page based on the choice of the visitor. the names of the text files are stored in a database and depending on the choice the file name is callaed to the page, but how to open it? can't do it with <include file> because html operates before asp. is there a way to open a text file using vb script or java script?<br />

Reply With Quote
  #2  
Old September 19th, 2000, 07:22 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Richard (richard@trinet.co.uk)</b></i><br />The following function will return the contents of a file on your web-server. Pass it the name of the file relative to the current document. For example, if you documents are in a folder called 'Documents', call:<br /> Response.Write _<br /> GetHTMLFile("Documents/test.html")<br />to output the contents of an HTML file called test. If the documents contain plain text, you may want to use:<br /> Response.Write Server.HTMLEncode _<br /> (GetHTMLFile("Documents/test.txt"))<br />to ensure it displays properly.<br /><br /><br />Function GetHTMLFile(strFileName)<br />Dim fso, file, FName<br />On Error Resume Next<br /> FName = Server.MapPath(strFileName)<br /> Set fso = Server.CreateObject _<br /> ("Scripting.FileSystemObject")<br /><br /> If Not(fso Is Nothing) Then<br /> If fso.FileExists(FName) Then<br /> Set file=fso.OpenTextFile(FName,1)<br /> GetHTMLFile = Trim(file.readAll())<br /> Else<br /> GetHTMLFile = _<br /> "<H3>File not found - " & _<br /> FName & "</H3>" & vbCrLf<br /> End If<br /> Set fso = Nothing<br /> Else<br /> GetHTMLFile="<H3>Unable to find file - " _<br /> & err.description & "</H3>"<br /> End If<br />End Function<br />

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > displaying text files without using include file


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT