• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multi upload

#1
I'm trying to create a control for upload multiple files

My controll:

PHP Code:
public function do_upload($path$subpath) {
 
   $files $_FILES['file']; $file ['file']=array();
 
   $num_file count($_FILES['file']['name']);
 
   echo $path;
 
   for ($i 1$i <= $num_file$i++) {
 
     if (isset($files[$i])) {
 
      $this->_CI->session->set_userdata(array('filename' => $files['name'][$i]));
 
      $this->load->library('upload'$this->set_upload_options());
 
      $this->upload->initialize($this->set_upload_options());
 
      chmod($path0777); chmod($subpath0777);
 
      $this->upload->do_upload($files[$i]);
 
      $error = array('error' => $this->upload->display_errors());
 
      foreach ($error as $errore)
 
       echo 'Errore: '.$errore;
 
      }
 
   }
}
 public function 
set_upload_options(){
 
// upload an image options
 
 $image ='gif|jpg|png|GIF|JPG|PNG';
 
 $config['upload_path'] = $this->session->userdata('subdir');
 
 $config['allowed_types'] = $image;
 
  $config['overwrite'] = TRUE;
 
  if (!empty($this->session->userdata('filename'))) {
 
     $config['file_name'] = $this->session->userdata('filename');
 
   }
 
   $config['max_size'] = 100;
 
   $config['max_width'] = 1024;
 
   $config['max_height'] = 768;
 
   $config ['encrypt_name'] = TRUE;

 
   return $config;
    } 

View
PHP Code:
....
....
.....
<?
php echo form_open_multipart('upload');?>
<?php 
echo form_upload('file[]','','multiple'); ?>
<input type="submit" value="upload" />

</form> 


I do not receive any error, but the file does not load

I do not know what to think.

Help me.

Thank you
Reply

#2
Try comparing your codes with this tutorial or just follow this tutorial below,
http://avenir.ro/codeigniter-tutorials/u...deigniter/
No SEO spam
Reply

#3
Tank you for help me Smile
Reply

#4
(12-09-2015, 05:08 PM)solidcodes Wrote: Try comparing your codes with this tutorial or just follow this tutorial below,
http://avenir.ro/codeigniter-tutorials/u...deigniter/

As of 2015 Winter, found the updated version here:
https://github.com/avenirer/MY_Upload
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.