question about writing with FileSystemObject

Results 1 to 2 of 2

Thread: question about writing with FileSystemObject

  1. #1
    Join Date
    Dec 1969

    Default question about writing with FileSystemObject

    I&#039;m trying to open an existing file into an html textarea, I want to be able to change any content of the file, and then send the updated file back. Can I send the updated file back with the same object or do I use Javascript onClick event(which I assume would be more work)? Plus I have to be able to send to a preview dir as well since the file is an include. I&#039;ve got this:<BR><BR>&#060;form name=topcont method=post&#062;<BR> &#060;%<BR> Response.Write("&#060;textarea name=update cols=80 rows=15&#062;")<BR> &#039;-----------------------------------------------------------------------------<BR> &#039; open file to be edited in textarea<BR> &#039;-----------------------------------------------------------------------------<BR> Set FSYS = Server.CreateObject("Scripting.FileSystemObject")< BR> FileName = "pathfile.asp"<BR> If FSYS.FileExists(FileName) Then<BR> Set TStream = FSYS.OpenTextFile(FileName, ForWriting)<BR> While Not TStream.AtEndOfStream<BR> Response.Write TStream.ReadLine<BR> Wend<BR> Else<BR> Response.Write "Application Failed to open the file, please try again"<BR><BR> End If<BR> Response.Write("&#060;/textarea&#062;")<BR><BR> Set TStream = Nothing<BR> Set FSYS = Nothing<BR> <BR> %&#062;<BR> &#060;/form&#062;

  2. #2
    Join Date
    Dec 1969

    Default Really a question about client/server...

    The *ONLY* way for *ANY* data to get sent from the client&#039;s browser back to the server is for an HTTP request/response to take place. <BR><BR>And 99.8% of the time, that means...SUBMIT the form!<BR><BR>And then process the form in the submitted to page.<BR><BR>THERE IS NO "PERSISTENT" CONNECTION between the server and that stuff you sent out to the browser. Neither the server nor the browser have ANY IDEA that you might want changes in the client to be reflected in the server.<BR><BR>You MUST code it ALL. By hand. <BR><BR>You have to submit the form to another page. That page has to get the text from the &#060;TEXTAREA&#062; field. That page has to open up the text file in WRITE mode, erasing the old contents. That page has to write the text to the test file.<BR><BR>And somehow, you *also* have to remember *which* text file you are going to do this to.<BR><BR>

Posting Permissions

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