0

我需要上传多张图片,我阅读了很多不起作用的文档,我看到了这个:

链接到问题: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);
        }



在视图中(添加)

当我使用我的视图但示例表没有显示任何错误时,但是当我使用我的表时它显示:

我的视图错误(列表)

4

2 回答 2

0

我发现了错误,我没有在路径末尾放/,并给我所有这些问题

"path_to_directory" => 'assets/test/',

至于以前的错误,我做了不同的测试来更改表的名称,它们就消失了。

于 2017-05-03T17:39:37.420 回答
-1

我也遇到了这个错误,它是由多上传列中已经存在的旧(未序列化)数据引起的。您必须对它们进行序列化或清空该字段。

于 2018-07-27T05:16:40.443 回答