gpt4 book ai didi

php - 如何在codeigniter中上传图片,错误号: 1136

转载 作者:行者123 更新时间:2023-11-29 18:35:14 25 4
gpt4 key购买 nike

  1. Controller 我希望用户可以将图像上传到我的数据库中“bukti_trnsfr”列的“发票”或“订单”表中谢谢

            public function payment_confirmation($invoice_id = 0 )
    {
    $data['get_sitename'] = $this->model_settings->sitename_settings();
    $data['get_footer'] = $this->model_settings->footer_settings();
    $config['upload_path'] = './uploads/';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size'] = '100';
    $config['max_width'] = '1024';
    $config['max_height'] = '768';
    $this->load->library('upload', $config);
    $this->form_validation->set_rules('invoice_id_input','Invoice id','required|integer');
    $this->form_validation->set_rules('amount_input','Amount Transfered','required|integer');

    if($this->form_validation->run() == FALSE)
    {
    if($this->input->post('invoice_id_input'))
    {
    $data['invoice_id'] =set_value('invoice_id_input');
    }else{
    $data['invoice_id'] = $invoice_id;
    $upload_image = $this->upload->data();
    $data_invoices = array(
    'bukti_trnsfr' => $upload_image['file_name']);
    }
    $this->load->view('customer/form_payment_confirmation',$data);
    }else{
    $is_valid = $this->model_customer->mark_invoice_paid_confirmed(set_value('invoice_id_input'),set_value('amount_input'),set_value('file_name'));
    if ($is_valid)
    {
    $this->session->set_flashdata('message','Terima Kasih, Produk Yang Anda Pesan Akan Segera Kami Proses');
    redirect('customer/shopping_history');
    }else{
    $this->session->set_flashdata('error','Jumlah Nominal Salah, Silahkan Coba Lagi ');
    redirect('customer/payment_confirmation/'.set_value('invoice_id_input'));
    }

    }
    }
  2. 这是我的模型。 公共(public)函数mark_invoice_paid_confirmed($invoice_id,$amount,$bukti_trnsfr) {//检查发票 $ret = TRUE; $data_invoices = $this->db->insert('发票', $bukti_trnsfr); $is_invoice = $this->db->where('id',$invoice_id)->limit(1)->get('发票'); if($is_invoice->num_rows() == 0 ) { $ret = $ret && FALSE;

                }else{//check the amount



    $total = $this->db->select('SUM(qty * price) AS total')
    ->where('invoice_id',$invoice_id)
    ->get('orders');
    if($total->row()->total > $amount )

    {
    $ret = $ret && FALSE ;
    }else
    {//mark the invoice to PAID
    $this->db->where('id',$invoice_id)->update('invoices',array('status'=>'confirmed'));
    }

    }
    return $ret;
    }

最佳答案

您忘记在代码中上传图像。验证运行正确后,使用下面提到的行在 codeigniter 中上传图像。

$this->upload->do_upload('file_name');

如果不起作用请告诉我。

关于php - 如何在codeigniter中上传图片,错误号: 1136,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45363731/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com