0

In my Delphi application, i try to download a file with TidFTP client (Indy 10, Delphi 2007) but the result file is bigger than the original. I have read other posts about it and about transferType but still i haven't solve the problem. The code is

IdFTP1 := TIdFTP.Create(NIL);
    with IdFTP1 do try
        Host := 'www.mysite.com';
        username := 'myName';
        password := 'myPassword';
        passive  := TRUE;
        Connect;
        transferType := ftBinary;
        IdFTP1.Get('mySite/data.zip','data.zip',TRUE);
    finally
        disconnect;
    end;

As you see i set transferType just before get, but the result is bigger (about 375 bytes) than the original.

PS. With the same code I haven't problems in the past (few years ago). Is it possible due to server's settings changes ? But FileZila works fine on the same file.

JimPapas
  • 715
  • 2
  • 12
  • 27
  • `TIdFTP.Get()` saves as-is whatever bytes the server gives it. `Get()` does not add bytes to the file. If the file that is saved is 375 bytes larger than you are expecting, double check the size of the file on the server, it is likely larger than you think. Maybe it got uploaded in ASCII mode instead of binary mode causing `CR` and `LF` characters to be expanded to `CRLF`. Who knows. We can't see the original file, the uploaded file, or the downloaded file, so we can't see what was changed. – Remy Lebeau Nov 16 '18 at 01:08
  • The file on the server is ok and i can download it with FileZilla (an FTP utility) at the right size. The problem is that the same file is downloaded bigger with my delphi code. – JimPapas Nov 16 '18 at 01:45
  • I can *guarantee* you that `TIdFTP.Get()` DOES NOT add extra bytes to the downloaded file. You need to verify with a packet sniffer what the server is actually sending to `TIdFTP` and compare that to what it sends to FileZilla. You are likely to see a difference in what data is being transmitted. That will also show you what commands both `TIdFTP` and FileZilla are using to setup the transfer parameters. – Remy Lebeau Nov 16 '18 at 02:58

0 Answers0