Multiple Image Upload Using Codeigniter

  • 3 years-4 months

    Multiple Image Upload Using Codeigniter

    • Category : php
    • Viewed : 88 times
    • Posted On :
    • Posted by : Guley

    Easy Multiple Image Using Codeigniter.

    if($_FILES['filename']['name']!='')
     {
           $image=array();
           $counts = count($_FILES['filename']['name']);
           $config['upload_path'] = APPPATH.'uploads/'; //create upload folder in application
                                                        // Give permission -R 777 to upload folder 
           $config['allowed_types'] = '*';
           $files = $_FILES;
           for($i=0; $i<$counts; $i  )
            {       
               if($_FILES['filename']['name'][$i]!='')
     { 
           $_FILES['filename']['name']= time().$files['filename']['name'][$i];
           $_FILES['filename']['type']= $files['filename']['type'][$i];
           $_FILES['filename']['tmp_name']= $files['filename']['tmp_name'][$i];
           $_FILES['filename']['error']= $files['filename']['error'][$i];
           $_FILES['filename']['size']= $files['filename']['size'][$i];
           $this->load->library('upload', $config);
           $this->upload->initialize($config);
           $upload= $this->upload->do_upload('familypicture');
           if($upload){
          $uu=$this->upload->data();
                $image[] =$uu['file_name'];
       }
             }
             }
       $fileToUpload = implode('|',$image);
    }
     

Report this or Ask your own question

Your Answer

When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.