Welcome Guest, Not a member yet? Register   Sign In
[ask]can't get return value from my function
#1

[eluser]rikes_denis[/eluser]
i try to make an upload function and try to passing a value to another function, but i got a trouble trying it.

this is my function :

Code:
function do_upload()
    {
        $config['upload_path'] = realpath('resume_upload');
        $config['allowed_types'] = 'doc|docx|xls|xlsx|ppt|pptx|pdf';
        
        
        $this->load->library('upload', $config);
        $this->load->library('Multi_upload');
        
        $files = $this->multi_upload->go_upload();
    //    var_dump($files);
        if ( ! $files )        
        {
            $error = array('error' => $this->upload->display_errors());
            $error['dynamiccontent'] = 'upload_form';
            $this->load->view('templates/template', $error);
        }    
        else
        {
            $data = array('upload_data' => $files);
            $data['dynamiccontent'] = 'success_upload';
            $this->load->view('templates/template', $data);        
            $c = 0;
            foreach($files as $file){
            $temp[$c] = $file['file'];
            $c++;}
            var_dump($temp);
            return $temp;
          }
        

    }

i return the $temp and try to pass it to other function, correct me if im wrong, but i use
Code:
$x = $this->do_upload();
foreach($x as $y){
echo $y;
}
to get the value and insert into varible on the other function.
is there something i didn't see???
please help
thanx




Theme © iAndrew 2016 - Forum software by © MyBB