[eluser]siubie[/eluser]
i have change my code to this one :
Code:
function addSponsor(){
$data['judul']=$this->Title;
$data['heading']="Penambahan Sponsor";
$data['heading2']="Penambahan Sponsor Pimnas 2009";
$data['nama']=array(
'name'=>'nama'
);
$data['gambar']=array(
'name'=>'gambar',
'type'=>'file'
);
$data['url']=array(
'name'=>'url'
);
$this->form_validation->set_rules('nama', 'Nama Sponosr', 'trim|required|xss_clean');
$this->form_validation->set_rules('gambar', 'Gambar Harus Di Isi', 'callback__gambar');
$this->form_validation->set_rules('url', 'Link Ke Sponsor', 'trim|required');
if ($this->form_validation->run() == FALSE)
{
$this->load->view('controlPanelAdmin/addSponsor.php',$data);
}
else{
$masukkan=$this->pimnas_model->masukkanSponsor();
if($masukkan){
$data['sukses']="Katalog Berhasil Dimasukkan";
}
else{
$data['sukses']="Katalog Gagal Dimasukkan";
}
$this->load->view('controlPanelAdmin/succedSponsor',$data);
}
}
function _userfile(){
$config['upload_path'] = './asset/img/sponsor/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->upload->initialize($config);
if (!$this->upload->do_upload('gambar'))
{
$this->form_validation->set_message('_gambar',$this->upload->display_errors());
return false;
} else {
return true;
}
}
no error but the file not uploaded to ./asset/img/sponsor i am using windows and xampp 1.6.4
and when i add validation rule
Code:
$this->form_validation->set_rules('gambar', 'Gambar Harus Di Isi', 'trim|required|callback__gambar');
the result is this form not valid