Today, We want to share with you how to upload multiple images in codeigniter?.In this post we will show you how to upload two different files in codeigniter, hear for multiple image upload with resize in codeigniter we will give you demo and example for implement.In this post, we will learn about how to display multiple images in codeigniter with an example.
Multiple file upload in codeigniter Example
In this Article, I will share how to upload multiple image Codeigniter 3 app with you. We can easily do multiple file upload instances in codeigniter.

I will give you simple example step by step to upload many files in codeigniter 3 application. We will use the upload library for multiple file uploads in Codeiner. We will store all images or files in our upload directory using the upload library.
So, let’s follow a few steps to upload multiple file or picture or images examples:
Step 1: Download Fresh Codeigniter 3
In the first step we will download a new version of Codeigniter 3, so if you have not downloaded yet, download from here: Download Codeigniter 3.
Step 2: Add Route
In this step you have to add some route to your route file. So first we will make a path for image uploading. Insert bellow content into route file: application/config/routes.php
Step 3: Create Controller
In this step, we need to make an "FileImgDoUpload" controller with index () and DoUploadFileImg (). So make items in this path application / controllers / items.php. application/controllers/FileImgDoUpload.php
load->helper('url'); } /** * Manage index * * @return Response */ public function index() { $this->load->view('ciimgFileUplodingFrm'); } /** * Manage DoUploadFileImg * * @return Response */ public function DoUploadFileImg() { $data = []; $count = count($_FILES['files']['name']); for($i=0;$i<$count;$i++){ if(!empty($_FILES['files']['name'][$i])){ $_FILES['file']['name'] = $_FILES['files']['name'][$i]; $_FILES['file']['type'] = $_FILES['files']['type'][$i]; $_FILES['file']['tmp_name'] = $_FILES['files']['tmp_name'][$i]; $_FILES['file']['error'] = $_FILES['files']['error'][$i]; $_FILES['file']['size'] = $_FILES['files']['size'][$i]; $config['upload_path'] = 'uploads/'; $config['allowed_types'] = 'jpg|jpeg|png|gif'; $config['max_size'] = '5000'; $config['file_name'] = $_FILES['files']['name'][$i]; $this->load->library('upload',$config); if($this->upload->do_upload('file')){ $uploadData = $this->upload->data(); $filename = $uploadData['file_name']; $data['totalFiles'][] = $filename; } } } $this->load->view('ciimgFileUplodingFrm', $data); } } ?>Step 4: Create View
In this step we will create the ciimgFileUplodingFrm.php view file. In this file we will write the design of html form using the form helper and url helper. So let's update the file: application/views/ciimgFileUplodingFrm.php
PHP Codeigniter - Upload Multiple Files and Images Example - Pakainfo.com
Okay now we are ready to run the above multiple file upload in codeigniter with example, but we need to create an "upload" folder on our root directory before the run instance. All pictures will upload to the "upload" directory, so give sure permission as well.
So let's run the bellow command on our root directory for instant run:
php -S localhost:8000
Now you can open URL below on your browser:
http://localhost:8000/image-upload
Make sure, first you have to set the base URL on your configuration file below:
$config['base_url'] = 'http://localhost:8000/';
Web Programming Tutorials Example with Demo
Read :
Summary
You can also read about AngularJS, ASP.NET, VueJs, PHP.
I hope you get an idea about multiple file upload in codeigniter with example.
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.