ASP
Here you can find some FREE usefull Classic ASP / VBScript code snippets, class modules, etc.
Function ReadFile(String)String
Read a local (text) file contents.
Example
Usage ReadFile (File path) You can specify both absolute or relative file paths. The function returns the text file contents. <% response.write ReadFile("help/index.html") %> Source Code <%
Function ReadFile(filename) dim fso, filepath, file set fso = server.createObject("Scripting.FileSystemObject") if mid(filename,2,1)<>":" and left(filename,2)<>"\\" then filepath = Server.MapPath(filename) else filepath=filename if fso.FileExists(filepath) Then Set file = fso.OpenTextFile(filepath,1) ReadFile=file.ReadAll set file=nothing end if set fso=nothing End Function %> |