title: Upload file to FTP Server using Indy
body: <p>I am unable to upload a file to my 000webhost.com FTP Server using Indy for Lazarus. I've tested the ftp connectivity with Windows Command Prompt, and it works fine. These are my Settings (IdFTP):</p>
  
  <pre><code>IdFTP1.Host:='shabala.com';
  IdFTP1.Passive:=True;
  IdFTP1.TransferType:=ftBinary;
  IdFTP1.Username:='******';
  IdFTP1.Password:='******';
  IdFTP1.Port:=21;
  </code></pre>
  
  <p>And this is the code which I use to call my TIdFTP component, IdFTP1:</p>
  
  <pre><code>IdFTP1.Connect(True);
  //IdFTP1.ChangeDir('/Sessions');
  IdFTP1.Put(GetCurrentDir+'\'+Token+'.cmd',Token+'.cmd', False);
  IdFTP1.Quit;
  IdFTP1.Disconnect;
  </code></pre>
  
  <p>where the variable <code>Token</code> is declared as:</p>
  
  <pre><code>Token: String; 
  </code></pre>
  
  <p>When I ran the program for the first time, it kept freezing and I declared a TIdAntiFreeze component to prevent it from freezing.
  So, this is what happens now: sometimes the program works fine, but no files are transferred to the server (If I try to repeat the upload, it gives me an EIdAlredyConnected error), and sometimes (if I change the code a bit, nothing extra) it gives me an EIdProtocolReplyError with a strange message. I tried to catch the exception and get my program to display the message, and I've got some strange characters:</p>
  
  <blockquote>
    <p>$ £ ï túÁÕÖ îÖõ)€¶K…ÅõÞl%ÇðåÀ¨Á“§pp<br>
    A¨%˜ßï7!ƒDªÉ[…oˆ_£P*¡°z1K¢H€Î¨ERPö/<br>
    üðÎƒç±ïpÄ¼ƒÏƒ‹Ò1ì<br>
    ¿Á{»(g{å¥r…Ž¹öÐ­R_JúÑ¯uBûŸ€Œ Pp6o¯c[JgžÎ¿­Èà¦Ä€VJþz’0è–`BO@T</p>
  </blockquote>
  
  <p>The response looks like this if formatted correctly:</p>
  
  <p><a href="https://i.stack.imgur.com/I2gGs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I2gGs.png" alt="Strange response"></a></p>
  
  <p>I couldn't put the formatted text here directly.</p>
  
  <p>The server works absolutely fine, the directories I'm trying to upload to are chmodded to 777, and I've discovered that the file's size (which I want to upload) isn't greater than 3 KBs.</p>
  
  <p>Any ideas?</p>