Buy Now
Sign in

Update file field

cesarvelame , January 12 2021, 17:11
C
cesarvelame 57
January 12 2021, 17:11 #395647
Hi, I have this file field "arquivo" in a CC6 form and works very well to create new records, but the edit works wrong. The edit form empty the file field record when is not filled.
I tried this code in a function before saving data with no success:
if(empty($this->data["arquivo"])){
unset($this->data["arquivo"]);
}
I tried this too:
$new_data = $this->data;
if(empty($this->data["arquivo"])){
unset($new_data["arquivo"]);
}
$this->set("new", $new_data);
{var:new} as the data provider, but no success.
Can anyone send a tip?
Thanks
C
cesarvelame 57
January 12 2021, 19:25 #395648
 Answer
Solved:
$this->data["doc"]["arquivo"] = $this->data["arquivo"];
if(empty($this->data["doc"]["arquivo"])){
unset($this->data["doc"]["arquivo"]);
}