Welcome Guest, Not a member yet? Register   Sign In
Multiple file uploads
#3

[eluser]neen[/eluser]
I never thought about that, but now I am doing using a completely separate field for each file...it is working perfectly!

Here's my code:

Code:
public function upload()
        {
            // setup the config
            $config['upload_path']   = "/Projects/{$this->config->item('common_path')}/assets/images/series/featured/";
            $config['allowed_types'] = 'gif|jpg|png';
            $config['overwrite']     = TRUE;
            $config['remove_spaces'] = TRUE;
            $this->load->library('upload', $config);
            
            $image_types = array("image/jpeg", "image/gif", "image/x-png", "image/png");
            
            $images      = array();
            // $imagesarray = array();
            $series = $this->input->post('featured_series');
            // we are saving the featured series...
            for($i =0; $i <= count($_FILES); $i++)
            {
                if(in_array(strtolower($_FILES['featured_image_'.$i]['type']), $image_types))
                {
                    // get the extension
                    $extension = split("[/\\.]", strtolower($_FILES['featured_image_'.$i]['name']));
                    $extension = $extension[(count($extension)) - 1];
                    
                    // get the new filename...
                    $category = $this->category_model->getCatbyID($series[$i]);
                    $_FILES['featured_image_'.$i]['name'] = url_title(strtolower($category['name']), 'dash') . '.' . $extension;
                    if(!$this->upload->do_upload("featured_image_{$i}"))
                    {
                        $error = $this->upload->display_errors();
                        dump($error);
                    } else {
                        $data = $this->upload->data();
                        dump($data);                    
                    }
                }
            }
        }

Obviously I am going to need to edit the $config stuff (gonna chuck that in config/upload.php)


Messages In This Thread
Multiple file uploads - by El Forum - 09-18-2008, 06:28 PM
Multiple file uploads - by El Forum - 09-18-2008, 08:05 PM
Multiple file uploads - by El Forum - 09-18-2008, 08:16 PM
Multiple file uploads - by El Forum - 09-18-2008, 08:19 PM
Multiple file uploads - by El Forum - 09-18-2008, 10:34 PM
Multiple file uploads - by El Forum - 09-19-2008, 07:06 AM
Multiple file uploads - by El Forum - 09-19-2008, 02:44 PM
Multiple file uploads - by El Forum - 12-24-2008, 03:16 PM
Multiple file uploads - by El Forum - 12-24-2008, 09:32 PM
Multiple file uploads - by El Forum - 12-26-2008, 11:04 PM
Multiple file uploads - by El Forum - 12-27-2008, 07:52 AM
Multiple file uploads - by El Forum - 02-07-2009, 03:30 PM
Multiple file uploads - by El Forum - 02-07-2009, 06:35 PM
Multiple file uploads - by El Forum - 02-13-2009, 02:02 PM
Multiple file uploads - by El Forum - 02-13-2009, 03:41 PM
Multiple file uploads - by El Forum - 02-14-2009, 12:57 PM
Multiple file uploads - by El Forum - 02-14-2009, 01:48 PM
Multiple file uploads - by El Forum - 02-14-2009, 03:19 PM
Multiple file uploads - by El Forum - 02-15-2009, 09:14 PM
Multiple file uploads - by El Forum - 02-16-2009, 05:36 AM
Multiple file uploads - by El Forum - 03-26-2009, 06:21 PM
Multiple file uploads - by El Forum - 07-12-2009, 08:54 AM
Multiple file uploads - by El Forum - 12-15-2009, 01:02 AM
Multiple file uploads - by El Forum - 02-08-2011, 02:26 AM
Multiple file uploads - by El Forum - 02-18-2011, 02:39 PM
Multiple file uploads - by El Forum - 02-24-2011, 10:46 AM
Multiple file uploads - by El Forum - 03-23-2011, 04:46 AM
Multiple file uploads - by El Forum - 02-29-2012, 02:48 AM
Multiple file uploads - by El Forum - 02-29-2012, 03:07 AM
Multiple file uploads - by El Forum - 02-29-2012, 03:15 AM
Multiple file uploads - by El Forum - 02-29-2012, 03:22 AM
Multiple file uploads - by El Forum - 02-29-2012, 05:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB