Welcome Guest, Not a member yet? Register   Sign In
Latavish's Multiple Image Upload with Thumbnail Generation
#25

[eluser]maria clara[/eluser]
hi to all,

im having an error with my upload script in CI. the image don't show off in the database and in the folder where it should be put in.

here's my script:
CONTROLLER:
Code:
$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);
                
                $file_data = $this->upload->data();
                $file_name = $file_data['file_name'];
                
                    $fields = array(
                "module_id",
                            "module_name",
                "slug",
                "icon"=>$file_name,            
                            "report_file_name",
                            "sql_select",
                            "sql_filter",
                            "sql_order"
                            );

                    foreach ($fields as $field)
                    {
                        if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);
                    }
                
                    $item = $this->input->post("item");
                    $rows = $this->input->post("row0");
                            
                    $data['item'] = $this->Reports->save($dt,$item,$rows);

MODEL:
Code:
function save($data,$item,$details) {
        if ($item == '') {
            $data['link'] = "reports/view";
            $this->db->trans_start();
            $this->db->insert('sec_reports', $data);
            $item = $this->db->insert_id();
            $this->save_detail($item,$details);                
            $this->db->trans_complete();
        }
        else {
            $this->db->trans_start();
            $this->db->where('module_id', $item);
            $this->db->update('sec_reports', $data);
            $this->save_detail($item,$details);                
            $this->db->trans_complete();
        }
        return $item;
    }

help me please..

regards,
kahtrina


Messages In This Thread
Latavish's Multiple Image Upload with Thumbnail Generation - by El Forum - 01-18-2010, 03:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB