Need help ASAP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phantom3008
    New Member
    • Feb 2007
    • 9

    Need help ASAP

    have a web application in which i need to include this feature.....I also do have the form and stuff ..
    Need to be able to display a text file with default values in it and then also should be able to alter the text in it and then save it ..

    I'm a beginner in this so Please could anyone help me with the code to do so......
  • phantom3008
    New Member
    • Feb 2007
    • 9

    #2
    Could someone plz help me out..........

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      This isn'ta really easy question, I've done it before with a really simple method I thought would always work, then when I switched servers it stopped. Anyway, to open a text file for reading:
      Code:
      <%
      dim fs, tf, line
      set fs = createObject("Scripting.FileSystemObject")
      set tf = fs.openTextFile("c:\inetpub\myFile.txt", 1, 0)
      do
         line = tf.readLine 
         response.write line
      loop until tf.AtEndOfStream
      tf.close
      %>
      of course, if you want the user to edit this, it should be within a textarea of a form, right? Anyway, if the text area was sent in a form as "fileText" you save it like this:
      Code:
      <%
      dim fs, tf
      set fs = createObject("Scripting.FileSystemObject")
      set tf = fs.createTextFile("c:\inetpub\myFile.txt")
      tf.write(request.form("fileText"))
      tf.close
      %>
      This might give an error when you try to over-write an existing file. I thought there was an easy fix, but I can't find it. Anyone else reading this know what it is?

      Comment

      Working...