⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

grocery_crud_file_upload_allow_file_types use it twice



mbmtnez
  • profile picture
  • Member

Posted 24 May 2017 - 14:40 PM

hello, I have a problem, I have in my database two fields, in both I save the link of a file, in one, an image, and in the other a file (PDF), I need, when I am adding or editing, when I select the Upload file, allow only the specific type of file. I do this:

 

//--- (BEGIN) Upload single file ---//
 
            $this->load->config('grocery_crud');
            $this->config->set_item('grocery_crud_file_upload_allow_file_types', 'pdf'); 
            $this->crud->set_field_upload('file', 'assets/files/'); 
          

//--- (end) Upload single file ---//

 

//--- (BEGIN) Upload single image ---//
 
            $this->load->config('grocery_crud'); 
            $this->config->set_item('grocery_crud_file_upload_allow_file_types', 'jpg|jpeg|gif|png'); 
            $this->crud->set_field_upload('image', 'assets/image'); 

 

//--- (END) Upload single image ---//

 

But, when I insert the first thing is the PDF, and it saids that can not be upload, and when I comment 'grocery_crud_file_upload_allow_file_types', 'jpg|jpeg|gif|png  it works, but I need restrict the types.

 

thanks in advance.