Search code examples
phpcodeigniterfile-uploadmulti-upload

Multiple upload of Grocery CRUD does not work


I need to upload multiple image, i read a lot of documentation that do not work, and I see this:

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

I made all what they said and, when I call in my view their controller "multiuploader" it works all fine, but, when I use in my own controller does not work. It saves images into the database and in the folder, but I can not see anything in the form, like the images in add, or the links in the list, even when i save in the same table before with the "multiuploader".

I apreciate a lot if you can help me. Thanks in advance.

This is my controller.

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)

when I use my view but the example table do not show any errors, but when I use my table it shows this:

error in my view with the view (list)


Solution

  • I find the error, I do not put a / in the end of the path, and give me all those problems

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

    As for the previous errors I did different tests changing the name of the table and they simply disappeared.