Update a .txt file via the web.


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Update a .txt file via the web.

  1. #1
    Knosse Guest

    Update a .txt file via the web.


    I have a little intranet with my own webserver. On the server ihave a .txt
    file i want to update from a website how do i do this the esyest way ?

    THx
    /Knosse

  2. #2
    T. Bradley Dean Guest

    Re: Update a .txt file via the web.

    If you are using ASP check out the FileSystem object. I know this can be
    used to open, edit, and save text files on a local server.

    Sorry, I don't have any code.

    --
    Bradley Dean




    Knosse <knosse75@hotmail.com> wrote in message
    news:397d3e62$1@news.devx.com...
    >
    > I have a little intranet with my own webserver. On the server ihave a .txt
    > file i want to update from a website how do i do this the esyest way ?
    >
    > THx
    > /Knosse




  3. #3
    Andrew King Guest

    Re: Update a .txt file via the web.

    If you are using ASP, try something like this:

    <%
    'File name and path we are creating/writing to
    strFilePath = "e:\inetpub\xxx.txt"
    'The data to save
    strData = "text here"
    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")

    If objFSO.FileExists(strFilePath) = False Then
    'if the file doesn't exist yet then create it
    Set objFile = objFSO.CreateTextFile(strFilePath, False)
    'Save the data to file
    objFile.WriteLine strData
    Set objFile = Nothing
    Else
    'Open the text file
    Set objTextStream = objFSO.OpenTextFile(strFilePath, ForAppend)
    'Append the data to the end of the file
    objTextStream.WriteLine strData
    'Close the file and clean up
    objTextStream.Close
    Set objTextStream = Nothing
    End If
    Set objFSO = Nothing
    %>

    Best
    Andrew



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center