Welcome Guest, Not a member yet? Register   Sign In
how to upload a json file?
#1

I tried with the below code, but its showing "The filetype you are attempting to upload is not allowed.". Can someone please help me with this

public function do_upload()
        {
                $config['upload_path']      = './uploads/';
                $config['allowed_types']    = 'jpg|png|php|json';
                $config['detect_mime'] = 'True';
                $config['max_size']        = 1024;

                $this->load->library('upload', $config);
                $data['value']=$this->input->post('company_id');
                if ( ! $this->upload->do_upload('userfile'))
                {
                        $data['error']=$this->upload->display_errors();
                        $data['results']=$this->Users_model->get_brands("1");
                        $this->load->view('add_gajson', $data);
                }
                else
                {
                        $data['results']=$this->Users_model->get_brands("1");
                        $this->load->view('add_gajson', $data);
                }
        }
Reply
#2

@Kaushik,

Are you sure that the file that you are trying to upload is one of the types allowed?
Reply
#3

I would allow txt as it's most likely getting flagged as an text file instead of json.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB