title: Post a file through https using indy / delphi components
body: <p>I'm trying to upload a file through https by using Indy components in delphi. Here is my code:</p>
  
  <pre><code>HTTP := TIdHTTP.Create(Self)
  IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create;   
  
  HTTP.Request.Host           := RemoteHost;
  HTTP.Request.Connection     := 'keep-alive';
  HTTP.Request.Accept         := 'multipart/mixed';
  
  HTTP.IOHandler              := IOHandler;
  HTTP.ConnectTimeout         := 0;
  HTTP.ReadTimeout            := 0;
  
  
  //### CREATE FILE TO SEND           
  TestStream := TIdMultipartFormDataStream.Create;
  try
  
    //### POST PARAMETERS
    TestStream.AddFormField('ReceiverId','LOOPTEST');
    TestStream.AddFormField('FileType','LOOPBACK');
  
    //### ADD FILE        
    TestStream.AddFile('filename','C:\PRUEBA.txt',GetMIMETypeFromFile('C:\PRUEBA.txt'));
  
    HTTP.Request.ContentType := TestStream.RequestContentType;
  
  
    HTTP.Post('https://www.remotehost.com/controller?function=submitfile',TestStream, Resultado);
  
  
    memResultado.Lines.Add(Resultado.DataString);
  
  
  finally
      FreeAndNil(TestStream);
      FreeAndNil(HTTP);
      FreeAndNil(IOHandler);
  end;
  </code></pre>
  
  <p>The server does not send any error. Just the file is not uploaded. Is there something wrong with my code?.</p>
  
  <p>I've spent two days trying to make it work :S.</p>
  
  <p>Any help will be appreciated. I'm using Delphi XE with Indy version 10.1.1.</p>
  
  <p><strong>Update:</strong> I used the Indy <code>TIdLog</code> component and here is the result. I cannot find nothing strange:</p>
  
  <pre><code>Stat Connected.
  Sent 05/09/2013 12:52:00 p.m.: POST /servlet/controller HTTP/1.1&lt;EOL&gt;Content-Type: application/x-www-form-urlencoded&lt;EOL&gt;Content-Length: 47&lt;EOL&gt;Host: ebmx.extra.client.com&lt;EOL&gt;Accept: text/html, /*&lt;EOL&gt;Accept-Encoding: identity&lt;EOL&gt;User-Agent: Mozilla/3.0 (compatible; Indy Library)&lt;EOL&gt;&lt;EOL&gt;
  Sent 05/09/2013 12:52:00 p.m.: function=login&amp;username=******&amp;password=******
  Recv 05/09/2013 12:52:01 p.m.: HTTP/1.1 200 OK&lt;EOL&gt;Server: Sun-ONE-Web-Server/6.1&lt;EOL&gt;Date: Thu, 05 Sep 2013 17:51:22 GMT&lt;EOL&gt;Content-type: text/html&lt;EOL&gt;Set-cookie: JSESSIONID=8035B4F90EBA1A337E4923520558E5DC;Path=/servlet&lt;EOL&gt;Transfer-encoding: chunked&lt;EOL&gt;&lt;EOL&gt;001a&lt;EOL&gt;Success! Member Type is 0&lt;LF&gt;&lt;EOL&gt;
  Recv 05/09/2013 12:52:01 p.m.: 0&lt;EOL&gt;&lt;EOL&gt;
  Stat Disconnected.
  </code></pre>
  
  <p></p>
  
  <pre><code>Stat Connected.
  Sent 05/09/2013 12:52:11 p.m.: POST /servlet/controller?function=submitfile HTTP/1.1&lt;EOL&gt;Content-Type: multipart/form-data; boundary=--------090513125207913&lt;EOL&gt;Content-Length: 525&lt;EOL&gt;Host: ebmx.extra.client.com&lt;EOL&gt;Accept: text/html, */*&lt;EOL&gt;Accept-Encoding: identity&lt;EOL&gt;User-Agent: Mozilla/3.0 (compatible; Indy Library)&lt;EOL&gt;Cookie: JSESSIONID=8035B4F90EBA1A337E4923520558E5DC&lt;EOL&gt;Cookie2: $Version="1"&lt;EOL&gt;&lt;EOL&gt;
  Sent 05/09/2013 12:52:11 p.m.: ----------090513125207913&lt;EOL&gt;Content-Disposition: form-data; name="ReceiverId"&lt;EOL&gt;Content-Type: text/plain&lt;EOL&gt;Content-Transfer-Encoding: quoted-printable&lt;EOL&gt;&lt;EOL&gt;LOOPTEST&lt;EOL&gt;----------090513125207913&lt;EOL&gt;Content-Dis‌​position: form-data; name="FileType"&lt;EOL&gt;Content-Type: text/plain&lt;EOL&gt;Content-Transfer-Encoding: quoted-printable&lt;EOL&gt;&lt;EOL&gt;LOOPBACK&lt;EOL&gt;----------090513125207913&lt;EOL&gt;Content-Dis‌​position: form-data; name="filename"; filename="PRUEBA.txt"&lt;EOL&gt;Content-Type: text/plain&lt;EOL&gt;Content-Transfer-Encoding: binary&lt;EOL&gt;&lt;EOL&gt;UKELELE 2013&lt;EOL&gt;----------090513125207913--&lt;EOL&gt;
  Recv 05/09/2013 12:52:15 p.m.: HTTP/1.1 200 OK&lt;EOL&gt;Server: Sun-ONE-Web-Server/6.1&lt;EOL&gt;Date: Thu, 05 Sep 2013 17:51:36 GMT&lt;EOL&gt;Content-type: text/html&lt;EOL&gt;Transfer-encoding: chunked&lt;EOL&gt;&lt;EOL&gt;0009&lt;EOL&gt;Failure!&lt;LF&gt;&lt;EOL&gt;
  Recv 05/09/2013 12:52:16 p.m.: 0&lt;EOL&gt;&lt;EOL&gt;  
  </code></pre>