You have to send files in binary data.read below.

In client of web service read the file  and store it in a variable. now 
send this as any other string. now in the server side you have to write it 
to your server using php write functions.

Say you have sample.zip to send to server.

normally rad it using fread(); send data as string and on the server side 
fwrite() with name and location you want.

Thanks,
kiran




On Saturday, 23 June 2012 01:25:54 UTC+5:30, darkangel wrote:
>
> Hi, I'm new to cake and I'm creating an application with some resources 
> exposed be accessed from a desktop aplication (web service)
> The web service its working fine but now I need to receive a file via a 
> POST request and I don't know how to do it. I'll appreciate the help you 
> could give me.
>
> this is my controller:
>
> class TransfersController extends AppController {
> public $name = 'Transfers'; 
> public $components = array('RequestHandler');
> public $helpers = array('Js');
>
> public function record($rfc = null, $numop = null, $source = null) {       
>  
> if ($this->request->is('post')) {
> if (strlen($rfc) > 0) {             
> if ($numop > 0) {
> $this->loadModel('Client');
> $client = $this->Client->findByRfc($rfc);
> if (!empty($client)) {
> if ($client['Client']['enabled'] == 1) { 
> * // code to read the file sent by POST request. help!!*
> *// I also need help to save that file to a LONGBLOB column*
> // set several values to insert in the database
> $this->Transfer->set('client_id', $client['Client']['id']);               
>          
> $this->Transfer->set('operation_num', $numop);
> $this->Transfer->set('source', $source);
> if ($this->Transfer->save($this->request->data)) {
> $message = 'Ok';
> } else {
> $message = 'No se pudo registrar la transmisión';
> }                    
> } else {
> $message = 'Su cuenta ha sido suspendida.';
> }
> } 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->set('message', $message);
> }
> }
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to