public function payment_confirmation($invoice_id = 0 )
{
$data['get_sitename'] = $this->model_settings->sitename_settings();
$data['get_footer'] = $this->model_settings->footer_settings();
$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;
}
$this->load->view('customer/form_payment_confirmation',$data);
}else{
$config['upload_path'] = './assets/uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 2000;
$config['max_width'] = 2000;
$config['max_height'] = 2000;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->upload->do_upload();
$upload_image = $this->upload->data();
$userfile = array(
'bukti_trnsfr' => set_value('userfile'));
$is_valid = $this->model_customer->mark_invoice_paid_confirmed(set_value('invoice_id_input'),set_value('amount_input'),$userfile);
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'));
}
}
}
这是用户确认付款的控制器。用户应在我的电子商务系统中上传图片作为汇款的证据。我遇到了这个问题,图像不在文件夹中,但图像名称保存在数据库表中。请帮忙!
答案 0 :(得分:0)
请找到下面提到的解决方案。它会对你有所帮助。
将FCPATH
附加到上传目录路径,如下所述。
$config['upload_path'] = FCPATH.'assets/uploads/';
您需要在do_upload()
$this->upload->do_upload('userfile');
在将名称保存到数据库之前,您还需要检查图像是否已上传到服务器上。
if($this->upload->do_upload('userfile')){
$userfile = array('bukti_trnsfr' => set_value('userfile'));
}else{
$userfile = array('bukti_trnsfr' => '');
}
如果不起作用,请告诉我。
答案 1 :(得分:0)
如果您使用了ubuntu平台或任何服务器,那么在尝试上传图片之后再使用此文件夹的权限,因为其权限问题