title: How do I do a chunked transfer-encoding upload with WWW:Mechanize?
body: <p>I'm attempting to use a particular web service, and I can successfully perform the upload with the following command:</p>
  
  <pre><code>curl -X POST  --header "Transfer-Encoding: chunked" -d @Downloads/file.pdf https://some.webservice/upload
  </code></pre>
  
  <p>I get back a json response indicate success.</p>
  
  <p>However, I'm unable to figure out how to do the same with WWW::Mechanize.</p>
  
  <pre><code>$mech-&gt;post("https://" . $server . "/upload", Content_Type =&gt; 'multipart/form-data', Content =&gt; [upID =&gt; $upid, name =&gt; $dlfile, userID =&gt; 0, userK =&gt; 0, file_0 =&gt; [$dlfile]]);
  </code></pre>
  
  <p>This receives a similar json response with a big fat error message in it. </p>
  
  <p>Do I need to explicitly set the Transfer-Encoding header first? Is there some other trick to it? Google's not shedding much light on this, Perlmonks neither, and the documentation's a little obtuse.</p>