Welcome Guest, Not a member yet? Register   Sign In
Multiple upload not working
#1

[eluser]amalik[/eluser]
Hi,
Before I ask my question I just want to mansion that I am new to codeigniter so if I am asking any thing stupid I am really sorry. I got a page in my website where I am giving functionality to my user to upload an image and a zip file. At any given time only one of them works. You can upload the image or the zip file, cant upload both of them at the same time. I dont know what the problem is. The part of the form where I am trying to upload the files is given below for you to have a look at
Code:
<?php echo form_open_multipart('');?>
Upload Image <input type="file" name="userfile" size="20" class="form_input"  />
Upload Zip File <input type="file" name="userfile1" size="20" class="form_input"  />

and my controller where I am uploading the files are as follows

Code:
//uploading image file
  if (!empty($_FILES['userfile']['name'])){
  
   /* inatilizing image upload details */
   $config['upload_path'] = './images/user/l_images/';
   $config['allowed_types'] = 'jpg|jpeg|png';
   $config['max_size'] = '10000';  

   $this->load->library('upload', $config);
  
   if(!$this->upload->do_upload('userfile')){
      /*display error*/
   }
  
   else{
    $file_data = $this->upload->data();
   }
  
  }


  //uploading the zip file
  if (!empty($_FILES['userfile1']['name'])){
  
   //print_r($_FILES['userfile1']);

   $configure['upload_path'] = './zip_files/';
   $configure['allowed_types'] = 'zip|rar';
   $configure['max_size'] = '20000';  

   $this->load->library('upload', $configure);
  
   if(!$this->upload->do_upload('userfile1')){
    /*display error*/
   }
  
   else{
    $zip_file_data = $this->upload->data();
   }
  
  }

I am really stuck and I will really appreciate if any body would like to help me.

Thanks in advance
amalik
#2

[eluser]achilleusrage[/eluser]
Are you possibly exceeding the maximum upload size (both file sizes combined)? Does adding this give you any more information:

Code:
echo $this->upload->display_errors();
#3

[eluser]amalik[/eluser]
Thanks a lot for your reply. This gives me something like "The filetype you are attempting to upload is not allowed." but I know I double and triple checked with different files I am uploading all are of right formats. My zip file is 11kb and my image file is 56kb and my limit is 10mb so I think it shouldnt be a problem.
#4

[eluser]achilleusrage[/eluser]
What types are reported when you echo this after an upload?

Code:
echo var_dump($_FILES);

Perhaps your browser is sending a mime type that CodeIgniter does not know about in config/mimes.php?




Theme © iAndrew 2016 - Forum software by © MyBB