multiple image upload with codeigniter

Solutions on MaxInterview for multiple image upload with codeigniter by the best coders in the world

showing results for - "multiple image upload with codeigniter"
Debora
08 Nov 2016
1    private function upload_files($path, $title, $files)
2    {
3        $config = array(
4            'upload_path'   => $path,
5            'allowed_types' => 'jpg|gif|png',
6            'overwrite'     => 1,                       
7        );
8
9        $this->load->library('upload', $config);
10
11        $images = array();
12
13        foreach ($files['name'] as $key => $image) {
14            $_FILES['images[]']['name']= $files['name'][$key];
15            $_FILES['images[]']['type']= $files['type'][$key];
16            $_FILES['images[]']['tmp_name']= $files['tmp_name'][$key];
17            $_FILES['images[]']['error']= $files['error'][$key];
18            $_FILES['images[]']['size']= $files['size'][$key];
19
20            $fileName = $title .'_'. $image;
21
22            $images[] = $fileName;
23
24            $config['file_name'] = $fileName;
25
26            $this->upload->initialize($config);
27
28            if ($this->upload->do_upload('images[]')) {
29                $this->upload->data();
30            } else {
31                return false;
32            }
33        }
34
35        return $images;
36    }
37
Fatima
05 Oct 2019
1views
2---------
3
4<?php echo validation_errors();?>
5<?php echo form_open_multipart('pages/multiple_files');?>
6<p><input type="file" multiple="multiple" name="image_name[]" class="form-control" /></p>
7
8<input type="submit" class="btn btn-success btn-block"/> 
9</form>
10
11Controller
12----------
13
14public function multiple_files(){
15  $this->load->library('upload');
16  $image = array();
17  $ImageCount = count($_FILES['image_name']['name']);
18        for($i = 0; $i < $ImageCount; $i++){
19            $_FILES['file']['name']       = $_FILES['image_name']['name'][$i];
20            $_FILES['file']['type']       = $_FILES['image_name']['type'][$i];
21            $_FILES['file']['tmp_name']   = $_FILES['image_name']['tmp_name'][$i];
22            $_FILES['file']['error']      = $_FILES['image_name']['error'][$i];
23            $_FILES['file']['size']       = $_FILES['image_name']['size'][$i];
24
25            // File upload configuration
26            $uploadPath = './assets/images/profiles/';
27            $config['upload_path'] = $uploadPath;
28            $config['allowed_types'] = 'jpg|jpeg|png|gif';
29
30            // Load and initialize upload library
31            $this->load->library('upload', $config);
32            $this->upload->initialize($config);
33
34            // Upload file to server
35            if($this->upload->do_upload('file')){
36                // Uploaded file data
37                $imageData = $this->upload->data();
38                 $uploadImgData[$i]['image_name'] = $imageData['file_name'];
39
40            }
41        }
42         if(!empty($uploadImgData)){
43            // Insert files data into the database
44            $this->pages_model->multiple_images($uploadImgData);              
45        }
46  }
47  
48Model
49---------
50  public function multiple_images($image = array()){
51
52     return $this->db->insert_batch('profile_images',$image);
53             }
54
55
queries leading to this page
upload two images in codeigniterupload multiple image php codeignitercodeigniter how to send multiple image files array in controllerupload multiple image codeigniter 3upload image in codeigniter 4multiple image upload with thumbnail php codeignitercodeigniter upload multi file with different namehow to update multiple image in codeigniterhow to upload multiple files in codeignitercodeigniter upload multiple image rest apicodeigniter 4 multiple image uploadmultiple image upload code in codeignitermultiple files upload codeigniter ajaxcodeigniter 3 multiple file upload 28array 29multiple file upload in codeigniter 3multiple image upload in codeigniter using ajaxmultiple image upload in codeigniter 3multiple file upload in api codeigniterupload more than one file codeigniterupload multiple image files in codeignitermultiple image upload in codeigniter with database examplecodeigniter do multi uploadcodeigniter multiple uplozdmulti image upload in codeignitercodeigniter multiple uploadmulti upload codeignitermulti image upload code cimultiple file upload in codeignitermultiple file upload codeigniter 3upload multiple images and save to database ajax codeigniter 3multiple image upload in codeigniter with json farmart database democodeigniter multiple image uploadupload multiple images codeigniterimages upload and edit in codeignitermultiple files download ajax codeignitermultiple file uploading in codeignitermultiple image upload in codeigniter 3 using ajaxupload multiple images in codeigniter using ajaxi am upload multiple file but same file upload multiple time in codeigniterhow to add multiple image in codeigniterupload multiple files jquery codeigniterupload multiple image in php codeigniter with preview with close buttonhow to upload image with multiple path in codeigniterupload two files in codeignitercodeigniter upload multiple imagescodeigniter 3 image upload with previewmultiple file upload in cicodeigniter 3 single file uploadjs multiple file upload codeigniter demohow to upload two images into two fields using codeignitercodeigniter attach multiple filesupload multiple image in codeigniter ecommercehow to upload two images in codeingiter with different inputcodeigniter multiple file upload 28array 29upload multiple file codeignitercodeigniter upload multipart fileupload multiple image input form php codeignitercurd multiple image upload in codeigniterhow to get multiple files in postman codeignitermultiple image upload in codeigniter with database democi multiple image uploadupload 2 file at a time using different location codeignitercodeigniter upload multiple file different directoryupload multiple file in different folder location in codeigniterhow to upload array of image in codeignitermultiple image upload commana seprated in codeigniterhow to insert multi image file field in codeignitermultiple file upload in codeigniter using databasehow to update two different images in codeigniterupload multiple input image php codeigniterhow to insert multiple image file in codeignitercodeigniter multiple image upload and resizeupload multiple images in different folder in codeigniterupload multiple images in different different folder in codeigniteradding multiple images in codeigniter not saving imagesadd multi photo using codeignitercodeigniter mulstiple file upload2 file upload chhsee in codeignitermultiple file upload in codeigniter using ajaxrest api upload multiple images using codeignitersingle image upload in codeignitermultiple file upload not working codeigniterfilepond multiple file upload codeigniter 3upload file dengan ajax codeignitercodeigniter multiple file upload ajaxmultiple file upload on codeigniterupload 2 input codeigniterupload 2 file with two different config in codeignitermulti image upload sql codeigniterupload multiple file codeigniter 3 with upload librarycodeigniter multiple file upload easyupload multiple image in codeigniter webslessoncodeigniter two image uploadmultiple image upload codeigniterhow to upload multiple images with data in codeignitercodeigniter 3 upload multiple filesupload multi image in codeigniterupload multiple files on codeigniterandroid studio upload multiple images to server codeigniter 3upload multiple file codeigniter 3multiple upload file codeigniter 3upload multiple files in php codeigniter input file multiplehow to upload multiple images in codeigniter 4how to upload multiple files in codeignitercodeigniter3 upload multiple file different directory lcodeigniter multi file uploadupload multiple images in codeignitermultiple files upload codeigniterjs multiple file upload codeigniterhow to uplaod multiple files in codeignitermultiple image view in codeigniter with databasehow to upload multiple images in codeignitercodeigniter 3 upload multiple files in for loop 5bhow to upload multiple image in codeignitercodeigniter jquery upload multiple image and previewfile upload in codeignitercodeigniter 3 multiple file upload 28array 29 githubcodeigniter handling multiple file upload2 file upload in codeigniterupload library in codeigniter use for multiple timesupload multiple file filepond codeigniter 3upload multiple foto and file codeigniterupload multiple image codeignitercodeigniter multiple file uploadscript multiple file upload code codeigniter 4multiple file attach in codeigniter live demotwo different field image upload to different location in codeigniterhow to upload multiple files rest api in codeigniter and store in databaseupload multiple photo codeigniter 3 jqueryhow to upload two different files in codeignitermultiple image upload in codeigniter with database source codemultiple file uploadafter login codeignitermultiple images upload in codeigniter using databaseupload multiple files php codeignitermultiple file upload in codeigniter crud functioncodeigniter 3 multiimage uploadmultiple image upload in codeigniter step by stepmultiple image upload in php codeigniterhow to upload 2 separate images in codeignitermultiple file upload with codeigniter 3how to save multiple image in database in codeigniterupload multiple codeigniter 3upload file codeignitercodeigniter upload single imagedo upload codeigniter multipledownload multiple files ajax codeignitermultiple image upload to server in codeigniterupload file in codeignitercode igniter upload multiple imagesmultiple image upload in codeigniterupload multiple file in codeigniter with add more optionci multiple file uploadcodeigniter file upload multiple filesmultiple files upload in codeignitermultiple image upload in codeigniter web servicemultiple image insert in codeigniterhow i can upload more than one file in codeigniter 3code igniter do upload multiplemultiple file file upload in codeigniter live demohandle two upload fields in a single form codeignitermulti file upload in codeignitercodeigniter 4 multiple file uploadcodeigniter 3 php upload multiple filescodeigniter upload multiple filesupload multiple image in codeigniter 4codeigniter multi uploadhow to update multiple images in codeigniterupload files from multiple field codeignitermulti upload file codeigniterhtml for multiple file upload in codeignitermultiple upload file codeigniterupload multiple image in codeigniter weblessonmultiple file attach in codeigniterhow to upload multiple images without page load using php ajax in codeignitercodeigniter upload multiple file typecode for uploading multiple image 2fvideo in codeigniter using for loopmultiple image update in codeignitercodeigniter multiple image upload with previewhow to insert mutiple file in database in codigniter 24this 3eload 3elibrary 28 27upload 27 2c 24config 2c multilpe uploadhow to upload multiple file in codeigniter how can i create multiple config array for file upload in codeignitermultiple image upload in codeigniter with databasemultiple images upload in cihow to upload multiple image in codeigniter apihow to get multiple file upload value in codeigniterhow to insert multiple image in database using codeignitercodeigniter two upload in controller different types configupload more than one files on codeignitercodeigniter multiple file upload examplemultiple file upload in php codeignitermultiple upload codeigniter ajaxupload multiple file in codeignitercodeigniter 3 multiple image upload with previewupload multiple images in codeigniter with previewadd multiple images in codeigniteradd multiple images in codeigniter 4upload files from 2 filefield codeigniterupload file multiple codeigniter 3codeigniter multiple file upload githubhow to upload two files on same form different path in codeigniterhandle multiple images upload in cimultiple image upload with codeignitermultiple image upload in codeigniter using ajax add more than oneuploading multipleimages with codeignitercodeigniter 3 multiple file uploadhow to upload multiple and single both image in codeigniter api2 file upload codeignitermultiple pdf file upload in codeignitermultiple file upload codeigniter demomultiple file upload in codeigniter 4multiple file upload codeignitermultiple image upload using ajax in codeignitermultiple file upload in codeigniter step by step 24this upload do upload in codeigniter multi fileformdata codeigniter multiple filescodeigniter 4 multipart file upload formpreview multiple image before upload in codeigniter 3upload multiple files in codeigniterphp multiple image upload codeignitermultiple file file upload in codeignitermultiple file upload atr in codeigniterupload and show multiple images in codeignitercodeigniter upload multipart file uploadhow to upload multiple images in php codeignitersave multiple file codeigniter 3upload multiple image in codeigniterform with image upload in codeigniter in multiple ajaxmultiple image upload with codeigniter