⚠ 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

I need help uploading file



vishok
  • profile picture
  • Member

Posted 22 August 2013 - 17:11 PM

i'm a newbie of grocerycrud

I need help to upload images in a folder, This is the code i used :           

 

            $crud = new grocery_CRUD();
            $crud->set_theme('twitter-bootstrap');
            $crud->set_table('news');
            $crud->set_subject('News');
            $crud->required_fields('titolo');
            $crud->add_fields('titolo','testo','autore','attivo');
            
    
            $this->config->set_item('grocery_crud_file_upload_allow_file_types', 'gif|jpeg|jpg|png');
            $crud->set_field_upload('image1','assets/uploads');
            $crud->set_field_upload('image2','assets/uploads');
            $crud->set_field_upload('image3','assets/uploads');
            $crud->callback_after_upload(array($this,'callback_after_upload'));
           
            $output = $crud->render();

 

but the buttons to upload images (image1,image2,image4) doesn't appear.

where is the mistake?
 

 


briggers
  • profile picture
  • Member

Posted 22 August 2013 - 17:56 PM

As far as I know you cannot do multiple file uploads in GC, but look at image crud at http://www.grocerycrud.com/image-crud


vishok
  • profile picture
  • Member

Posted 22 August 2013 - 17:59 PM

thanks but i have the same problem with this code:

$crud = new grocery_CRUD();
            $crud->set_theme('twitter-bootstrap');
            $crud->set_table('news');
            $crud->set_subject('News');
            $crud->required_fields('titolo');
            $crud->add_fields('titolo','testo','autore','attivo');
            
    
            $this->config->set_item('grocery_crud_file_upload_allow_file_types', 'gif|jpeg|jpg|png');
            $crud->set_field_upload('image1','assets/uploads');
           
            $crud->callback_after_upload(array($this,'callback_after_upload'));
           
            $output = $crud->render();


vishok
  • profile picture
  • Member

Posted 22 August 2013 - 18:00 PM

As far as I know you cannot do multiple file uploads in GC, but look at image crud at http://www.grocerycrud.com/image-crud

thanks but i have the same problem with this code:

$crud = new grocery_CRUD();
            $crud->set_theme('twitter-bootstrap');
            $crud->set_table('news');
            $crud->set_subject('News');
            $crud->required_fields('titolo');
            $crud->add_fields('titolo','testo','autore','attivo');
            
    
            $this->config->set_item('grocery_crud_file_upload_allow_file_types', 'gif|jpeg|jpg|png');
            $crud->set_field_upload('image1','assets/uploads');
           
            $crud->callback_after_upload(array($this,'callback_after_upload'));
           
            $output = $crud->render();


briggers
  • profile picture
  • Member

Posted 22 August 2013 - 19:06 PM

Try changing

  $crud->add_fields('titolo','testo','autore','attivo');

to - adding the field image1 to the "add" form

  $crud->add_fields('titolo','testo','autore','attivo','image1');

davidoster
  • profile picture
  • Member

Posted 23 August 2013 - 08:45 AM

Hello and welcome to the forums [member=vishok].

Actually [member=victor] has made a really good attempt for multiple file uploading. Check here: /topic/1912-updated-30072013-multiple-uploading/#entry8698