Results 1 to 2 of 2

Thread: Could someone please help me with this?

  1. #1

    Thread Starter
    Hyperactive Member Zaphod64831's Avatar
    Join Date
    Mar 2000
    Posts
    268

    Question

    I have some code here, and when I run it on my FTP server it says that it can't create the FileSystemObject, can someone please debug it for me? I've separated the buggy line from the rest to help.

    Code:
    <Script language="VBScript" RUNAT="Server">
    	Const ForReading = 1, ForWriting = 2, ForAppending = 8
    	Dim Visitor, fso, MyFile, Data,
    	
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	
    	Set MyFile = fso.OpenTextFile("testfile.txt", ForReading, True)
    	Data = MyFile.ReadLine
    	Visitor = CInt(Data)
    	Visitor = Visitor + 1
    	Document.Write "<h1>" & Visitor & "</h1>"
    	MyFile.Close
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	Set MyFile = fso.OpenTextFile("testfile.txt", ForWriting, True)
    	MyFile.Write Visitor
    	MyFile.Close
    </Script>
    Email: [email protected]

    Home Page: www.olemac.net/~hutch

    I'm bored, VERY bored, and I got bored with my sig. So I changed it to this.

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    FTP server??

    with a few tweaks it runs on PWS ok.

    Code:
    <%@ Language=VBScript %>
    <%option explicit%>
    <HTML>
    
    <BODY>
    <%
    	Const ForReading = 1, ForWriting = 2, ForAppending = 8
    	Dim Visitor, fso, MyFile, Data
    	
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	
    	Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForReading, True)
    	Data = MyFile.ReadLine
    	Visitor = CInt(Data)
    	response.Write "<h1>" & Visitor & "</h1>"
    	MyFile.Close
    	Visitor = Visitor + 1
    	Set fso = CreateObject("Scripting.FileSystemObject")
    	Set MyFile = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
    	MyFile.Write Visitor
    	MyFile.Close
    
    %>
      
    </BODY>
    </HTML>
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width