[eluser]thematrixuum[/eluser]
Here's my view :
Code:
<div id="upload_box" style="display:none"><h3>Upload File</h3>
<form id="upload_form" enctype="multipart/form_data" method="post">
<input type="file" name="userfile" />
<br /><br />
<input type="submit" value="upload" />
</form></div>
Here's my controller :
Code:
public function upload_pro() {
$this->template->set_output("xhr");
$this->template->response = $this->klien->do_upload();
$this->template->publish();
}
Here's a part of my model :
Code:
public function do_upload()
{
//array('error' => ' ' );
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (!!$this->upload->do_upload($this->input->post('userfile')))
{
$data = array('upload_data' => $this->upload->data());
return array(
'SUIXHR' => true,
'callback' => 'Js.widget.notice.success',
'text' => 'OK'
);
}
else
{
$error = $this->upload->display_errors();
return array(
'SUIXHR' => true,
'callback' => 'Js.widget.notice.error',
'text' => $error
);
}
}
can anybody help? is it because of mime type? because the error always showing 'You did not selected any file'..