Is it possible to multi file upload usign codeigniter 1.7 and a loop?

后端 未结 2 1079
天涯浪人
天涯浪人 2021-01-22 02:33

I\'ve been trying to do a multi file upload with codeigniter 1.7. I\'m having issues to say the least!

I know its an old version but that\'s what I\'ve got to work with.

2条回答
  •  失恋的感觉
    2021-01-22 02:54

    Hope This will help

    $name_array=array(); 
    $count = count($_FILES['userfile']['size']);
    foreach($_FILES as $key => $value)
    {
        for ($s = 0; $s < $count; $s++)
        {
    $_FILES['userfile']['name'] = $value['name'][$s];
            $_FILES['userfile']['type'] = $value['type'][$s];
            $_FILES['userfile']['tmp_name'] = $value['tmp_name'][$s];
            $_FILES['userfile']['error'] = $value['error'][$s];
            $_FILES['userfile']['size'] = $value['size'][$s];
            $config['upload_path'] = "uploads/item_images/itemimage/original/";
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '8000';
            $config['max_width'] = '10240';
            $config['max_height'] = '7680';
            $this->load->library('upload', $config);
            if ($this->upload->do_upload("image"))
            {
                $data = $this->upload->data();
              if ($this->image_moo->errors)
                {
                    print $this->upload->display_errors();
                }
                else
                {
                    $name_array[] = $data['file_name'];
    
                } } } }
    

提交回复
热议问题