Welcome Guest, Not a member yet? Register   Sign In
multiple files upload not working?
#1

I want to upload multiple files and upload in database.
Code:
<input type="file" name="files1" id="file0" accept="application/pdf" />
<input type="file" name="files2" id="file0" accept="application/pdf" />
<input type="file" name="files3" id="file0" accept="application/pdf" />
<input type="file" name="files4" id="file0" accept="application/pdf" />
<input type="file" name="files5" 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
Reply


Messages In This Thread
multiple files upload not working? - by kvanaraj - 07-05-2019, 01:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB