⚠ In case you've missed it we are migrating 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 forum is read-only and soon will be archived. ⚠

How to set fields after upload with file information

after_upload upload fields set

  • Please log in to reply
No replies to this topic

#1 Gonzalo Morel

Gonzalo Morel


  • Members
  • Pip
  • 2 posts

Posted 05 May 2016 - 05:47 PM



i have a question: how i use the data to set fields, example obtain size and extension to send to fields on callback_after_upload,


i try to create two vars $extension and $size but doesn't work




PD: sorry for my english.


public function images()
        $crud = new Grocery_CRUD();


        $crud->order_by('image_id', 'asc');

        $crud->set_relation('customer_id', 'gm_customers', 'customer_name');

        $crud->columns('imagen','image_name', 'customer_id', 'image_type', 'image_extension', 'image_size');
        $crud->field_type('image_random', 'hidden', 'abcdefghij');
        $crud->field_type('image_md5', 'hidden', ' ');
        $crud->field_type('image_size', 'hidden');
        $crud->field_type('image_active', 'true_false');        
        $crud->field_type('image_type', 'dropdown',array('1' => 'botón', '3' =>'icono', '0' => 'Logos y fondos'));
        $crud->set_field_upload('image_extension', 'assets/uploads/files'); 

        $crud->display_as('customer_id', 'Cliente')
                ->display_as('image_type', 'Tipo')
                ->display_as('image_md5', 'Encriptación')
                ->display_as('image_random', 'Nombre aleatorio')
                ->display_as('image_extension', 'imágen')
                ->display_as('image_size', 'Peso de imágen')
                ->display_as('image_active', 'Activo')
                ->display_as('image_name', 'Nombre');


        $output = $crud->render();

public function callback_after_upload($uploader_response,$field_info, $files_to_upload)
        $field = $field_info->encrypted_field_name;
        $extension = explode('/',$files_to_upload[$field]['type']);
        return $this;
public function obten_data_image_callback($post_array)
        $post_array['image_extension'] = $this->getExtension();
        $post_array['image_size'] = $this->getImage_size();
        return $post_array;




Also tagged with one or more of these keywords: after_upload, upload, fields, set

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users