title: How to stream an HTTP file upload without the Content-Length header?
body: <p>Is it possible to upload a file to an apache php server without including the content-length header ?</p>
  
  <p>I am trying to stream a file that I am creating on the fly as a file upload. When I don't use the content-length header I got the apache "501 Method Not Implemented". </p>
  
  <pre><code>$sock = fsockopen($host,80,$errno, $error);
  fwrite($sock, "POST $resource HTTP/1.1\r\n" .
                       "Host: $host\r\n\r\n");
  fwrite($sock,fread($readHandle,filesize($file)));
  </code></pre>
  
  <p>If I include the content-length it works fine.</p>
  
  <p>The server is reading from php://input  </p>