2016-07-15 04:28
浏览 56

CI:您没有选择要上传的文件。 错误

okay, this is my controller :

public function buktisaldo(){
//load library
//Set the config
$config['upload_path'] = "./assets/images/campaigner/";
$config['allowed_types'] = "*";
//Upload file
if( !$this->upload->do_upload("bukti")){
    //echo the errors
    echo $this->upload->display_errors();
    $data = array(
        'bukti' => $this->upload->file_name
    $id = $this->session->userdata('id');
    $this->db->where('status','Sedang Diproses');

and this is my view :

<?php echo form_open('member/buktisaldo');?>
<input type="file" name="bukti">
<input type="submit" value="send">
<?php echo form_close();?>

and when i run this code, it shows error "You did not select a file to upload."

this is var_dump() script :

UPDATE `saldo` SET `bukti` = '' WHERE `id_user` = '74' AND `status` = 'Sedang Diproses'

it seems like my input name is wrong, but its correct, how to fix that ?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doumiang0597 2016-07-15 04:52

    In Controller :

    Change This

       $file_name = $this->upload->data('file_name'); 
       $data = array('bukti' => $file_name);

    In View :

    form should be like this :

    <?php echo form_open_multipart('member/buktisaldo');?>
    解决 无用
    打赏 举报

相关推荐 更多相似问题