title: Receive files on a REST web service using a POST request
body: <p>I'm trying to get files making a POST request to an action. The web service is working fine but I can't retrieve that file "as it is". Cake automatically transfoms the $this->request->data into an array and that's not what I need. I need to save that file into a BLOB column in my db.</p>
  
  <p>Please help me!!! </p>
  
  <p>Thanks in advance for you help!!</p>
  
  <p>this is my controller code, I'm on CakePHP 2.1.0:</p>
  
  <pre><code>class TransfersController extends AppController {
  public $name = 'Transfers'; 
  public $components = array('RequestHandler');
  
  public function record($rfc = null, $numop = null, $source = null) {        
      if ($this-&gt;request-&gt;is('post')) {
          if (strlen($rfc) &gt; 0) {             
              if ($numop &gt; 0) {
                  $this-&gt;loadModel('Client');
                  $client = $this-&gt;Client-&gt;findByRfc($rfc);
                  if (!empty($client)) {
                     if ($client['Client']['enabled'] == 1) {
                          // unknown way to get the received file                         
  
                          $this-&gt;Transfer-&gt;set('client_id', $client['Client']['id']);                             
                          $this-&gt;Transfer-&gt;set('num_operacion', $numop);
                          $this-&gt;Transfer-&gt;set('source', $source);
                          // $this-&gt;Transfer-&gt;set('xml', $this-&gt;request-&gt;data);
                          if ($this-&gt;Transfer-&gt;save($this-&gt;request-&gt;data)) {
                              //$message = 'Ok';
                              $message = $data;
                          } else {
                              $message = 'No se pudo registrar la transmisión';
                          }
                      } else {
                          $message = 'Su cuenta ha sido suspendida. Póngase en contacto con nostros para resolver éste inconveniente.';
                      }
                  } else {
                      $message = 'El RFC ' . $rfc . ' no está registrado';
                  }
              } else {
                  $message = 'El número de operación no es válido';
              }
          } else {
              $message = 'El RFC no es válido';
          }
      } else {
          $message = 'La petición es inválida';
      }
      $this-&gt;set('message', $message);
  }
  }
  </code></pre>