multiple files upload not working? |
I want to upload multiple files and upload in database.
Code: <input type="file" name="files1" id="file0" accept="application/pdf" /> public function upload() { $this->data['notification'] = ''; if( $this->input->post('btn_contact_details') ) { // loading helpers $this->load->helper(array('form', 'url')); //setting the config array, for more options see Codeigniter docs $config['upload_path'] = './asset/images/upload/'; // upload path $config['allowed_types'] = 'pdf'; // allowed file types // loading upload library with config array $this->load->library('upload', $config); // uploading the files, lets_upload() is defined below $this->lets_upload('files1'); $this->lets_upload('files2'); $this->lets_upload('files3'); $this->lets_upload('files4'); $this->lets_upload('files5'); } $this->load->view('auth/modal', $this->data); } public function lets_upload( $field_name ) { if ( ! $this->upload->do_upload( $field_name )) { $this->data['notification'] .= $this->upload->display_errors(); } else // if uploading success { $upload_data = $this->upload->data(); $this->data['notification'] .= $upload_data['file_name']." is successfully uploaded.<br>"; } } Nothing upload in path . how to check it.need suggestion
Do you ever search Google or do you just come here and hope you will get the answer to your question?
How to upload Multiple Files and Images in CodeIgniter What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(07-05-2019, 04:30 AM)InsiteFX Wrote: Do you ever search Google or do you just come here and hope you will get the answer to your question? I am not asking multiple files to be uploaded at a time. If u know answer reply otherwise don't make stupid reply. "you just come here".
@kvanaraj,
Maybe this link will help you... https://stackoverflow.com/questions/8377...75#8381575 Once you get the files uploaded to a particular place on the server then you can add them to the related database record.
Make sure your form has this opening tag:
PHP Code: <form method="post" action="some_action" enctype="multipart/form-data" /> Put this code at the top of your lets_upload method: PHP Code: echo '<pre>'; This will show you the file data from your view. Once you get this part working, you can remove this piece of code. |
Welcome Guest, Not a member yet? Register Sign In |