Search code examples
delphifiremonkey

Delphi IdFTP Timeout


Hi I use to IdFtp for image upload to server.My code is uploaded an image but after upload IDFTP does not disconnect.I cant find why im taking this result. My code is

 Tfrm_main.fotoYolla(d:Timage;fileName:String);
    var
      Params: TIdMultipartFormDataStream;
      Response: TStringStream;
      var ms:TMemoryStream;

    begin


    ms := TMemoryStream.Create;
    try
      d.Bitmap.Resize(300,400);

      d.Bitmap.SaveToStream(ms);
     with IdFTP1 do
      try
       Host := 'myserver';
        Username :='anonymous';
        Password :='1234';
        Port:=21;
        Connect;

        Ms.Position := 0;
        Put(Ms, fileName);
      finally
        Disconnect;
      end;
    finally
      ms.Free;
      d.Free;
    end;
    ShowMessage('İmage is updated.');
    end;

After this code i taking 'Read Time Out' message.


Solution

  • @valex write to true step on comment at my questions post.Its

    passive:=true;
    

    I added this code and finely work.Thank you