CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2010
    Posts
    9

    Reading and writing a txt on ftp.

    Hi
    I was wondering if it was possible to read/ write on a txt on a server?
    So I can open a txt thats located on for example http://www.internet.com/text.txt
    And I want to be able to save changes made to the file. I guess FTP is the way of doing this?
    Anyone that can help me out?

  2. #2
    Join Date
    Oct 2005
    Location
    Seattle, WA U.S.A.
    Posts
    353

    Re: Reading and writing a txt on ftp.

    FTP may not be the only way to achieve your goal but it is certainly one way to do it (assuming the server supports FTP). And fortunately, it's not very difficult to write although it may be a little on the time-consuming side.

    One can find the requisite information here ...
    http://www.w3.org/Protocols/rfc959/


    On the other hand, it may not be necessary to write your own .... I seem to recall that Windows comes with an underlying FTP client, or I would imagine one might find FTP shareware for almost-nada, or yet another option: http://ipswitch.com/.

    If you do decide to write your own, it seems likely to me that you'd be able to get away with writing a subset of the full FTP. Your stated goals seem pretty modest.
    Last edited by ThermoSight; December 21st, 2010 at 03:36 PM.

  3. #3
    Join Date
    Dec 2010
    Posts
    12

    Re: Reading and writing a txt on ftp.

    To connect to the FTP server we can use the FtpWebRequest C# object under the System.Net namespace. The object is created with the FtpWebRequest.Create() function. Note that the function will ask for a URL to connect to, the format to write the url is: [FTP Address] + "/" + [Filename of file to upload].

    PS : Taken from http://www.vcskicks.com/csharp_ftp_upload.php

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

Featured