CodeIgniter Forums
how to send file from rest server to client on the response? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: how to send file from rest server to client on the response? (/showthread.php?tid=57506)



how to send file from rest server to client on the response? - El Forum - 03-19-2013

[eluser]dinisptc[/eluser]
how to send file from rest server to client on the response?

the file its the avatar af605bd9daf75d754b4d1135e8349e1a.jpg
Code:
{"login":"login success!","user_admin_id":"18","projects":[{"id":"15","uid":"1","clientUID":"18","dateCreation":"2013-03-18 15:30:49","projectName":"My Dream House","adress1":"Aiguille du Midi","adress2":"3842 meters","postcode":"74400","city":"Chamonix","country":"FR","descriptive":"

\n\tPerfect spot for ski!<\/p>\n","avatar":"af605bd9daf75d754b4d1135e8349e1a.jpg","status":"1"}]}
this its the code :
Code:
function login_post()
    {


$remember = (bool) $this->post('remember');
if ($this->ion_auth->login($this->post('email'), $this->post('password'), $remember))
        {

          $projects=array();
          $user_id=$this->projects_model->check_user_id();
          ////get user_id
          $group = 'architect';
          $groupmember ='members';
          if($this->ion_auth->in_group($group))
          {
           //get all projects for the admin architect
             $status=1; //open
           $projects=$this->projects_model->get_myprojects_admin($status,$this->session->userdata('user_id'));

          }elseif ($this->ion_auth->in_group($groupmember))
          {

           //get only assigned projects
           $status=1; //open

           $projects=$this->projects_model->get_myprojects_emp($status,$this->session->userdata('user_id'));

          }


$this->response(array('login' => 'login success!','user_admin_id'=>$user_id,'projects'=>$projects), 200);




        }else
        {
        
                 $this->response(array('error' => 'Couldn\'t login!'), 404);
        
        }


    }



how to send file from rest server to client on the response? - El Forum - 03-20-2013

[eluser]rana[/eluser]
Hi, I am not completely clear about your question. Please describe more. Do you want to send the image in serialized format to the requesting client from your REST server or something else?


how to send file from rest server to client on the response? - El Forum - 03-20-2013

[eluser]dinisptc[/eluser]
serialized format should be good