【问题标题】:Multiple upload of Grocery CRUD does not workGrocery CRUD 的多次上传不起作用
【发布时间】:2017-05-03 16:56:44
【问题描述】:

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

Link to the question: set_field_upload - how to custom multi image upload in grocery_CRUD library on codeigniter?

我按照他们所说的做了,当我在我的视图中调用他们的控制器“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);
        }



in the view (add)

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

error in my view with the view (list)

【问题讨论】:

  • 您是否遇到任何错误?你看过错误日志吗?
  • 在视图中我没有看到任何错误。我在哪里寻找错误日志?
  • 当我使用我的视图但示例表没有显示任何错误,但是当我使用我的表时它显示

标签: php codeigniter file-upload multi-upload


【解决方案1】:

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

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

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

【讨论】:

    【解决方案2】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多