title: Why are files sometimes a different size or corrupt after transferring by FTP?
body: <p>I'm having a problem downloading a file using the TidFTP component in Delphi XE2. I am able to get a connection to the FTP site, get a list of files and perform the get command. However, when I try to download a file using the get command the file always downloads larger than the source file. Then the subsequent file is corrupt.</p>
  
  <p>Additionally, if I try to download multiple files, the first file downloads (larger than the source) and the remaining files are skipped. No error is thrown from the get command, it just quits. I tried to hook into some of the events on the TidFTP control like AfterGet and OnStatus but everything appears normal.</p>
  
  <p>I tried using a 3rd party FTP client to access the file and download it just to make sure it was not a problem with our FTP server and that download worked as expected. So I'm thinking it might be related to the TidFTP control or perhaps I'm doing something incorrectly.</p>
  
  <p>Here is the routine I'm using to download the file:</p>
  
  <pre><code>var
    ftp: TIdFTP;
    strDirectory: string;
  begin
    ftp := TIdFTP.Create(nil);
    try
      ftp.Host := 'ftp.myftpserver.com'
      ftp.Passive := false;
      ftp.Username := 'TestUser';
      ftp.Password := 'TestPassword';
      ftp.ConnectTimeout := 1000;
      ftp.Connect();
      ftp.BeginWork(wmRead);
      ftp.ChangeDir('/TestArea/');
      strDirectory := 'c:\test\';
      if not DirectoryExists(strDirectory) then
        CreateDir(strDirectory);
      ftp.Get('Test.zip', strDirectory + '\' + 'Test.zip', true, false);
     ftp.Disconnect();
    except
      on e: exception do
        showMessage(e.message);
    end;
  end;
  </code></pre>