Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: idftp put procedure corrupts file.



Permlink Replies: 1 - Last Post: Sep 15, 2016 10:22 AM Last Post By: Remy Lebeau (Te...
David Drouin

Posts: 16
Registered: 11/11/11
idftp put procedure corrupts file.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2016 6:19 AM
ftp := TIdFTP.Create(self);
ftp.Passive := true;
ftp.Host := 'ftp.domain.com';
ftp.Username := 'some_user';
ftp.Password := 'some_password';
ftp.Connect;
ftp.Put( any_file_or_stream,'remote_path',false,0);
ftp.Disconnect;

whatever file you 'put' it is always 2kb short. behavior applies to win32,android. havent tested ios

Did I miss a hotfix? what is going on

Edit: this fixed it.

ftp.TransferType := ftBinary;

Edited by: David Drouin on Sep 15, 2016 8:41 AM
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: idftp put procedure corrupts file. [Edit]
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 15, 2016 10:22 AM   in response to: David Drouin in response to: David Drouin
David wrote:

whatever file you 'put' it is always 2kb short. behavior applies
to win32,android. havent tested ios

Did I miss a hotfix? what is going on

You are not setting the TransferType property, which is set to ftASCII by
default, per RFC 959. ASCII mode may alter data during transmission (in
particular, line break characters are normalized and potentially changed,
depending on the platforms involved).

Edit: this fixed it.

ftp.TransferType := ftBinary;

Yes, that is the solution.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02