This topic is locked

Save file size of doc in field in Before record added

2/11/2021 2:07:18 AM
PHPRunner General questions
A
alfonso authorDevClub member

I have a file / image field called "filename" where I save pdf files. In another field called "file_size1" I want to store the size of the file.

I know that I have to do that inside the Events-> Before record added, but I don't know exactly how to do it.
Something like:

$size_of_file = filesize($values['filename']);
$values['file_size1']=$size_of_file;
return true;
Any ideas? Thank you