我需要上传多张图片,我阅读了很多不起作用的文档,我看到了这个:
链接到问题:set_field_upload - 如何在 codeigniter 上的grocery_CRUD 库中自定义多图像上传?
我做了他们所说的一切,当我在我的视图中调用他们的控制器“multiuploader”时,它工作得很好,但是,当我在自己的控制器中使用时,它不起作用。它将图像保存到数据库和文件夹中,但我看不到表单中的任何内容,例如添加中的图像或列表中的链接,即使我之前使用“multiuploader”保存在同一个表中也是如此。
如果你能帮助我,我很感激。提前致谢。
这是我的控制器。
public function Test() {
$this->crud = new Grocery_CRUD_Multiuploader();
$this->crud->set_table('multi_uploader_gallery');
$this->crud->set_subject('Document');
$this->crud->fields("title", "my_pictures", "my_files", "my_mail_attachments");
$this->crud->columns("title", "my_pictures", "my_files", "my_mail_attachments");
$config = array(
/* Destination directory */
"path_to_directory" => 'assets/test',
/* 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'
);
$this->crud->new_multi_upload("my_pictures", $config);
$output = $this->crud->render();
$data['contents'] = 'contents';
$data = array_merge($data, (array) $output);
$this->load->view('template', $data);
}
当我使用我的视图但示例表没有显示任何错误时,但是当我使用我的表时它显示: