[eluser]pistolPete[/eluser]
Have a look at the
documentation:
Quote:$this->upload->do_upload()
Performs the upload based on the preferences you've set.
Note: By default the upload routine expects the file to come from a form field called userfile, and the form must be a "multipart type:
So all you have to do is call your two form fields differently, e.g.
image and
document, then process both form fields:
Code:
$image_data = array();
$document_data = array();
// load library only once
$this->load->library('upload');
// image configuration
$image_config['upload_path'] = './uploads/';
$image_config['allowed_types'] = 'gif|jpg|png';
$image_config['max_size'] = '1000';
$image_config['max_width'] = '1024';
$image_config['max_height'] = '768';
$this->upload->initialize($image_config);
// process image upload first
if ( ! $this->upload->do_upload('image'))
{
// image upload error , display error etc.
}
// image was uploaded properly, continue
else
{
$image_data = $this->upload->data();
// document configuration
$document_config['upload_path'] = './uploads/';
$document_config['allowed_types'] = 'pdf';
$this->upload->initialize($document_config);
if ( ! $this->upload->do_upload('document'))
{
// document upload error , display error etc.
// you might need to delete the former uploaded image file ...
}
else
{
$document_data = $this->upload->data();
}
}