Welcome Guest, Not a member yet? Register   Sign In
failed to upload image file and save data
#22

[eluser]cestaz18[/eluser]
CONTINUATION OF CONTROLLER

Code:
function post() {
            //$this->output->enable_profiler(true);
            $c = "";
            $data['action'] = $this->input->post('action');
            

            
            if ($data['action']=='view') {
                $dt['module_id'] = $this->input->post('item');
                $report['report_id'] = $this->input->post('item');
                $details = $this->Reports->getDetails($dt);

                if ($details) {
                    $data['db'] = array('item'=>$dt['module_id'],
                                        'module_name'=>$details['module_name'],
                                        'slug'=>$details['slug'],
                                        'icon'=> $details['icon'],                                        
                                        'report_file_name'=>$details['report_file_name'],
                                        'sql_select'=>$details['sql_select'],
                                        'sql_filter'=>$details['sql_filter'],
                                        'sql_order'=>$details['sql_order']
                                        );
                    $data['count'] = $this->Reports->countDetailList($report);
                    $c .= $this->Reports->getParameters($report);
                }
                $data['response'] = $c;
                $json['json'] = $data;
            }
           [b] else if ($data['action']=='save') {
                $item = $this->input->post("item");
                $dt['module_name'] = $this->input->post('module_name');
    
                $report_exist = $this->Reports->getDetailsByName($dt);

                if ($report_exist && $item != $report_exist['module_id'])
                {
                    $c .= 'Report already exists.';
                    $data['action'] = 'exist';
                }
                else
                {
                
                $config['upload_path'] = './reports/module/';
                $config['allowed_types'] = 'gif|jpg|png';
                $config['max_size']    = '100';
                $config['max_width']  = '1024';
                $config['max_height']  = '768';
                $this->load->library('upload', $config);
                
                 /*if ($this->upload->do_upload())
                {*/
                    $this->upload->do_upload();
                    $file_data = $this->upload->data();
                    //$file_name = $file_data['file_name'];
            
                    
                    
                    $fields = array(
                    "module_name"=>$this->input->post('module_name'),
                    "slug"=>$this->input->post('slug'),    
                   "icon"=>$this->input->post('file_name'),          
                    "report_file_name"=>$this->input->post('report_file_name'),
                    "sql_select"=>$this->input->post('sql_select'),
                    "sql_filter"=>$this->input->post('sql_filter'),
                    "sql_order"=>$this->input->post('sql_order')
                    );        
                    
            

                
                    
                    $item = $this->input->post("item");
                    $rows = $this->input->post("row0");
                            
                   // $data['item'] = $this->Reports->save($form_data,$fields,$item,$rows);    
                    $data['item'] = $this->Reports->save($fields,$item,$rows);    
                    
                    //Insert it here
                    echo $this->db->last_query();
                    
                    $c .= 'Successfully saved item';
                    
                    
              /*  }*/[/b]
                }
                $data['response'] = $c;
                $json['json'] = $data;
                
            }


Messages In This Thread
failed to upload image file and save data - by El Forum - 01-18-2010, 09:41 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 09:53 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 09:57 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 10:05 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 10:10 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 11:23 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 11:30 PM
failed to upload image file and save data - by El Forum - 01-18-2010, 11:35 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 12:09 AM
failed to upload image file and save data - by El Forum - 01-19-2010, 12:22 AM
failed to upload image file and save data - by El Forum - 01-19-2010, 03:34 AM
failed to upload image file and save data - by El Forum - 01-19-2010, 06:50 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 07:23 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 07:39 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 07:43 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:08 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:17 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:22 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:33 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:37 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:43 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:46 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:48 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:50 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:51 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 08:56 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 10:40 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:04 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:06 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:07 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:11 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:18 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:26 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:38 PM
failed to upload image file and save data - by El Forum - 01-19-2010, 11:56 PM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:01 AM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:09 AM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:17 AM
failed to upload image file and save data - by El Forum - 01-20-2010, 12:26 AM



Theme © iAndrew 2016 - Forum software by © MyBB