set_field_upload - how to custom multi image upload in grocery_CRUD library on codeigniter?

前端 未结 1 802
轮回少年
轮回少年 2021-01-21 18:49

I need to upload multiple image from grocery_CRUD Library on codeigniter framework.

I need step by step process !

$crud->set_field_upload         


        
相关标签:
1条回答
  • 2021-01-21 19:16

    Try Grocery_Crud_Multiuploader library, I wrote long back, might help you, instructions are given in github, current library supports files as well as images

    grocery_crud_multiuploader

    Load library like below

    function __construct()
    {
           parent::__construct();
           $this->load->database();
           $this->load->helper('url');
           $this->load->library('grocery_CRUD');
           $this->load->library('Grocery_CRUD_Multiuploader');
    }
    

    In controller function

    public function multi_upload()
    {
       $crud = new Grocery_CRUD_Multiuploader(); 
       $crud->set_table('content');
       $crud->where('state', 1);   
       ...
       ...
       $config = array(
            /* Destination directory */
            "path_to_directory" =>'assets/grocery_crud_multiuploader/GC_uploads/pictures/',
    
           /* Allowed upload type */
          "allowed_types" =>'gif|jpeg|jpg|png',
    
          /* Show allowed file types while editing ? */
          "show_allowed_types" => true,
    
         /* No file text */
         "no_file_text" =>'No Pictures',
    
         /* enable full path or not for anchor during list state */
         "enable_full_path" => false,
    
         /* Download button will appear during read state */
         "enable_download_button" => true,
    
         /* One can restrict this button for specific types...*/
        "download_allowed" => 'jpg'
      );
    
      $crud->new_multi_upload("image",$config);
      ...
      ...
      $output = $crud->render();
      $this->_example_output($output);
    }
    
    0 讨论(0)
提交回复
热议问题