save uploaded image in database by using codeigniter

Today, We want to share with you file upload in codeigniter.In this post we will show you multiple files upload in codeigniter with example, hear for files upload and download in codeigniter we will give you demo and example for implement.In this post, we will learn about How To Upload Image In Codeigniter Mysql Database And Display? with an example.

Codeigniter File Upload | Image Upload Library Example

Upload Form(Html View)



Upload File Form















Codeigniter File Upload Controller Example:

load->helper(array('form', 'url'));
        }

        public function index()
        {
                $this->load->view('upload_form_view', array('error' => ' ' ));
        }

        public function process_upload()
        {
                $config['upload_path']          = './uploads/';
                $config['allowed_types']        = 'gif|jpg|png';
                $config['max_size']             = 2048;
                $config['max_width']            = 1000;
                $config['max_height']           = 800;
                $this->load->library('upload', $config);

                if ( ! $this->upload->process_upload('myfile'))
                {
                        $error = array('error' => $this->upload->display_errors());

                        $this->load->view('upload_form_view', $error);
                }
                else
                {
                        $data = array('upload_data' => $this->upload->data());

                        $this->load->view('success_view', $data);
                }
        }

}
?>

Success Page(Html View)



Upload Success - www.pakainfo.com



The file was successfully uploaded.

    $value):?>
  • :

I hope you get an idea about files upload in codeigniter using database.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment