Results 1 to 6 of 6

Thread: Upload text file to website... FTP?

  1. #1

    Thread Starter
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Question Upload text file to website... FTP?

    How would i go about uploading a text file to my FTP site?
    Through VB? or perhaps have a server side php script and pass the via the URL?

    But I'd prefer the VB method... any ideas?
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Upload text file to website... FTP?

    There are a few different ways. The fact that it is a text file makes very little difference.

    Using FTP you would use the Put statement. I have not fooled around much with the VB Inet control but I think it can do this.
    I have a 3rd party FTP control that I have used in the past and in some cases I have just used the command line FTP. Been a while so memory is not clear on how I did this but it was likely using shell and a redirect so the FTP program would read the input from a text file. That file would contain the statements to open the address, login, put the file and then logout and close the FTP session.

  3. #3
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Upload text file to website... FTP?

    Quote Originally Posted by DataMiser View Post
    There are a few different ways. The fact that it is a text file makes very little difference.
    Actually it makes a huge difference.

    FTP makes a distinction between text and binary file transfers. For a text file transfer the client converts the text from native OS format to generic FTP text format, and the server converts from FTP format to its own native OS format.

    So a Windows FTP client sending text files is taking the files as ASCII (though it will cheat and use ANSI codes above 127 and hope for the best), looking for CRLF line delimiters, and treating Ctrl-Z as an EOF marker if present. This gets converted into FTP's format for transmission, though those codes above 127 may fail.

    A *nix FTP server receiving text files takes the assumed-to-be ASCII characters and writes them to a file with LF line delimiters.

    Typical IBM FTP servers would convert to EBCDIC text, either using an end-of-record control character or padding with spaces to a fixed record length if specified via a SITE command or by server config options.

    RFC 3659 FTP clients and servers will successfully transfer text with other encodings besides 7-bit ASCII, but most are not compliant.


    Sadly the poor little crippled ITC ("INet" control) can only do binary file transfers. This can lead to a mangled file when you upload or download text. The only fix is to convert the file to/from the server's format yourself.
    Last edited by dilettante; Dec 23rd, 2014 at 01:17 PM.

  4. #4
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,206

    Re: Upload text file to website... FTP?

    I think both the 3rd party tool I have used and the commandline FTP may very well auto switch between ASCII and binary as needed when sending files. I know the FTP program I use does.

  5. #5
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Upload text file to website... FTP?

    Windows' command line FTP client:

    ftp> help binary
    binary Set binary transfer type
    ftp>
    There is no "auto switching."

  6. #6
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,454

    Re: Upload text file to website... FTP?

    Don't know where the problem is, with uploading your own TextFiles in binary mode -
    then downloading them again in binary mode.

    This will make sure, that nothing in the whole process is fiddling around with your encodings
    (as they are currently applied to your TextFiles on your Windows-machine).

    Olaf

Tags for this Thread

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