set_field_upload - 如何在 codeigniter 的 grocery_CRUD 库中自定义多图像上传?
set_field_upload - how to custom multi image upload in grocery_CRUD library on codeigniter?
我需要从 codeigniter 框架上的 grocery_CRUD
库上传多张图片。
我需要一步一步的过程!
$crud->set_field_upload('image','assets/uploads/products');
$crud->callback_after_upload(array($this,'resize_after_upload'));
现在这仅作为单个图像上传工作。有人可以帮忙吗?
试试Grocery_Crud_Multiuploader库,我回头写了很久,可能对你有帮助,说明在github, 当前库支持文件和图片
像下面这样加载库
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
$this->load->library('grocery_CRUD');
$this->load->library('Grocery_CRUD_Multiuploader');
}
在控制器函数中
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);
}
我需要从 codeigniter 框架上的 grocery_CRUD
库上传多张图片。
我需要一步一步的过程!
$crud->set_field_upload('image','assets/uploads/products');
$crud->callback_after_upload(array($this,'resize_after_upload'));
现在这仅作为单个图像上传工作。有人可以帮忙吗?
试试Grocery_Crud_Multiuploader库,我回头写了很久,可能对你有帮助,说明在github, 当前库支持文件和图片
像下面这样加载库
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->helper('url');
$this->load->library('grocery_CRUD');
$this->load->library('Grocery_CRUD_Multiuploader');
}
在控制器函数中
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);
}