Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check if file exists 1

Status
Not open for further replies.

NiteCrawlr

Programmer
Mar 16, 2001
140
BR
Hi,
I have an ASP page which has a form, and when the user clicks on submit, all the information is saved in a text file, after that, a "robot" created in Automate takes the information in that file and send it to a PComm emulator, after the robot receive the answer from the Pcomm, it saves the answer in another text file.
My question is, is there anyway I could make an ASP page which CHECKS if the answer file exists and then it takes the information in that file and shows it to the user?


 
Yes you can do this - try this for starters...
Code:
<%
strFile = &quot;c:\temp\test.txt&quot;
Set objFSO = Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)

If objFSO.FileExists(strFile) Then
  Set objFile = objFSO.OpenTextFile(strFile, ForReading)
  Response.Write objFile.ReadAll
  Set objFile = Nothing
Else
'file does not exist
End If

Set objFSO = Nothing
%>
Tony
reddot.gif WIDTH=500 HEIGHT=2 VSPACE=3

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top