⚠ 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

Getting field value on edit



rbergh
  • profile picture
  • Member

Posted 27 February 2019 - 10:06 AM

I cannot figure this out.

 

I have a form with two fields:

 

1) Type

2) Image

 

the path for the image should be relative and be based on Type. 

 

$crud->set_field_upload('image1','download/'.$type.'/');

 

How to get the value of type?

 

Important, I am in edit mode, row already exists and type is also Primary key.

 

 

Any help welcome


rbergh
  • profile picture
  • Member

Posted 01 March 2019 - 07:07 AM

I do have a solution (do not know if it is good)

 

Let the image be saved to a fixed folder,

In callback_after_insert and callback_after_update move the file to the right folder.

 

Problem however is that sometimes the move returns an OK and no error but did not work.  Even a check of file exists says it is there on the new location.

I do have experienced this multiple times before!!!

 

 

Is there a secure way of moving/renaming a file in php (one that works)?