husin.anti husin.anti - 1 year ago 52
SQL Question

CI : You did not select a file to upload. error

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
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 ?

Answer Source

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');?>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download