Indy FTP Failing to upload miserably

前端 未结 1 732
清酒与你
清酒与你 2020-12-06 21:01

Using a simple code, such as:

  procedure TForm1.cxButton1Click(Sender: TObject);
  begin
  ftp.Host := \'domain\';
  ftp.Username := \'user\';
  ftp.Passwor         


        
相关标签:
1条回答
  • 2020-12-06 21:25

    The app freezes because Indy uses blocking operations. While the code is running, the main message loop is not running, so new messages are not being processed until cxButton1Click() exits. To solve that, either place a TIdAntiFreeze component onto your TForm, or else move the TIdFTP code to a separate worker thread, and then use TIdSync or TIdNotify to update the UI safely when needed.

    The file will be "corrupted" if you are transferring it in ASCII mode instead of in binary mode. Make sure the TIdFTP.TransferType property is set to ftBinary. Indy 9 and earlier defaulted to ftBinary, but Indy 10 defaults to ftASCII instead (to match the FTP protocol specs).

    0 讨论(0)
提交回复
热议问题