//CODE to handle uploads
function do_upload($data)
{
$objResponse = new xajaxResponse();
$config['upload_path'] = './photos/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1030';
$config['max_height'] = '773';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload($data['userfile']))
{
$error = array('error' => $this->upload->display_errors());
//$objResponse->Assign("ajax_div", "innerHTML",$this->upload->display_errors());
$objResponse->Assign("ajax_div", "innerHTML",$this->upload->display_errors());
}
else
{
$data = array('upload_data' => $this->upload->data());
$objResponse->Assign("ajax_div", "innerHTML", "Just saying hello from XAJAX.");
}
return $objResponse;
}
//html to send image
<form id="up_form" enctype="multipart/form-data" name="up_form" method="post">
<input type="file" name="userfile" id="userfile" size="20" />
<br /><br />
<button type="button" onclick="xajax_do_upload(xajax.getFormValues('up_form'));">Save</button>
</form>
The above code is intended for uploading an image. I am using codeIgniter and Xajax framework but each time I upload, The system says 'You have not selected a file to upload.'
Can somebody help me.
Thanks.