Your WebCode

Log In / Submit Code / Join     

Find Code
    Highest Rated
    Newest
    Most Viewed
    Browse
           ASP
           ASP.NET
           CSS
           JAVA
           JavaScript
           PERL
           PHP


Resources
  
Web Hosting Company
for Programmers

Norwich Web Design
eShop commerce software
PHP Jobs
budget web hosting
Ventrilo
bedroom furniture
Mortgages
Lawnmowers
Fridge Freezers
Christening Gifts
Digital Photo Frames


Simple Example: Read a Text File

 Language:  ASP Unrated
Rated by 0 Users

1 Star = Horrible
5 Stars = Perfect
Rate Code Now
 Posted By:  blake
 Author Website:  Differences between ASP and PHP
 Posted On:  7/9/2007
 Code Views:  2929
   This is a simple example showing how to read in the entire contents of a textfile into a single ASP variable.



<%
dim fs, filereadstream, tmpfile

Set fs = CreateObject("Scripting.FileSystemObject")
Set filereadstream = fs.OpenTextFile(Server.MapPath("filename.txt"), 1)

tmpfile = filereadstream.readall

filereadstream.Close
set filereadstream = nothing
set fs = nothing

'the variable 'tmpfile' now contains the entire file 'filename.txt'
%>


View code in Textarea

This code has not been tested by Your WebCode.
Use it at your own risk.
Please report any copyright violations.



Reviews
Hide Reviews | Add Review | Delete Review 
No Reviews

Blog | Monthly Contest | Current Contest Leaders | FAQ | Link to us
Privacy Policy | Terms | Credits | Other Sites | Contact Us
Copyright © 2008, Your WebCode.