title: Codeigniter RESTserver. Null response
body: <p>I am using Codeigniter and Phil's REStful API.</p>
  
  <p>I am making a call to the server and the problem is it return a NULL value. The value that should be return is a blob that is 65000 in length. I reckon its because of the length of the blob, but I don't know how to solve this issue.</p>
  
  <p>Here's how i call the api:</p>
  
  <pre><code>$resp = call('upload_api/upload/format/json/', array('uploaded_files' =&gt; $_FILES['upload'], 'file_details' =&gt; 'test'));
  echo '&lt;pre&gt;'; print_r($resp);
  
  public static function call($resource, $params, $method='get')
  {
      if (empty($params))
      {
          $params = array();
      }
      $headers = '';
      $url = self::API_URL . $resource;
      $curlObj = curl_init();
      curl_setopt_array($curlObj,
                      array(
                          CURLOPT_URL =&gt; $url,
                          CURLOPT_RETURNTRANSFER =&gt; true,
                          CURLOPT_TIMEOUT =&gt; 20
                      ));
      switch ($method)
      {
          case 'get':
              $query_str = http_build_query($params);
              $url = $url .= '?' . $query_str;
              curl_setopt($curlObj, CURLOPT_URL, $url);
              break;
          case 'put':
              $headers[] = 'Content-Type: application/json';
              curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
              curl_setopt($curlObj, CURLOPT_CUSTOMREQUEST, 'PUT');
              curl_setopt($curlObj, CURLOPT_POSTFIELDS, json_encode($params));
              break;
          case 'post':
              $headers[] = 'Content-Type: application/json';
              curl_setopt($curlObj, CURLOPT_HTTPHEADER, $headers);
              curl_setopt($curlObj, CURLOPT_POST, true);
              curl_setopt($curlObj, CURLOPT_POSTFIELDS, json_encode($params));
              break;
          default:
          // error message
      }
  
      $data = curl_exec($curlObj);
  
      $contentType = curl_getinfo($curlObj, CURLINFO_CONTENT_TYPE);
      switch ($contentType)
      {
          case 'application/json':
              $data = json_decode($data, true);
              break;
      }
  
      curl_close($curlObj);
  
      return $data;
  }
  </code></pre>
  
  <p>Here's the method:</p>
  
  <pre><code>    require APPPATH.'/libraries/REST_Controller.php';
  class Upload_api extends REST_Controller {
  
      public function upload_get()
      {
  
          $this-&gt;load-&gt;model('Upload_File');
          $upload_file = new Upload_File();
          $total_rows = $upload_file-&gt;count();
          $upload_file-&gt;get(1, 0)-&gt;all;
  
          // file_content is a blob
          $this-&gt;response(array('file' =&gt; $upload_file-&gt;file_content, 'total_rows' =&gt; $total_rows), 200); 
  
      }
  
  }
  </code></pre>