Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $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();
- }
- }
Add Comment
Please, Sign In to add comment