⚠ 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

How to set the upload folder according the operation of CRUD (add, edit)?



Pakman_reload

Pakman_reload
  • profile picture
  • Member

Posted 21 October 2015 - 17:25 PM

Hello, how can I set the value of set_field_upload according the state of the CRUD operation?

				    $state = $crud->getState();
				    $state_info = $crud->getStateInfo();
				    		    				    
				   if ( $state == 'edit' )
				    {
				    	$primary_key = $state_info->primary_key;
					$crud->set_field_upload('foto', 'assets/data/' . $primary_key);	

				    }
				    elseif ( $state == 'add' ) 
				    {
                                         $crud->set_field_upload('foto', 'assets/uploads');	
				    } // if	

This is my code but, don't work, any suggestion? thanks