title: Sending a file via PUT to codeigniter REST_Controller
body: <p>I'm trying to upload some files to a web-server via PUT.</p>
  
  <p>I'm using Phil Sturgeon's REST library on the server side. </p>
  
  <p>The client is a PHP application using curl to generate the requests.</p>
  
  <pre><code>...
  curl_setopt($ch, CURLOPT_PUT, true);
  curl_setopt($ch,CURLOPT_INFILE,$fp);
  curl_setopt($ch,CURLOPT_INFILESIZE,$fsize);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
  $headarray = array();
  if ($api_key)
      $headarray[] = 'X-API-KEY:'.$api_key;
  $headarray[] = "Content-Type: application/octet-stream";
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headarray);
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_exec($ch);
  ...
  </code></pre>
  
  <p>The data is being received. 
  However when I look at $this->put() on the server side, I get an array which looks like my input file got parsed. I would like the entire file to be available as one string, as raw data.</p>
  
  <p>I tried to use  <code>fopen("php://input", "r");</code> instead, but it's blank. Presumably this has already been consumed by the REST library.</p>
  
  <p>I haven't written a PUT request before using curl, so maybe something is wrong on that side of things.</p>
  
  <p>Is there an alternative to $this->put() which will give me the raw input rather than an array.</p>
  
  <p>It seems that I may have to put my file into a parameter, if so, how to do that with curl when I'm using CURLOPT_INFILE? I want to be able to send large files without running into php's memory limit.</p>