Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function bulk_product_upload_file()
- {
- $location_of_bulk_product_files = LOCATION OF FOLDER;
- if ($this->is_post()):
- if (is_uploaded_file($_FILES['userfile']['tmp_name'])):
- $date_for_file = date("dmyHis");
- $config['upload_path'] = $location_of_bulk_product_files; //upload directory
- $config['allowed_types'] = 'xlsx'; // allowed file types
- $config['max_size'] = '100';
- $config['overwrite'] = TRUE;
- $config['remove_space'] = TRUE;
- $config['file_name'] = $date_for_file;
- $this->load->library('upload', $config);
- if($this->upload->do_upload()):
- // I have also tried if($this->upload->do_upload('userfile')): that resulted in the same error
- echo "file upload success";
- else:
- echo "file upload failed";
- endif;
- else:
- $this->session->set_flashdata('message_error','Please select a file to upload.');
- redirect('main/create_bulk_product');
- endif;
- else:
- $this->session->set_flashdata('message_error','Sorry! Somthing went wrong, please try again.');
- redirect('main/create_bulk_product');
- endif;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement