Storing file size and mime type from uploaded file.
I understand that I should be using the
afterStateUpdated
method, but how can I inject these two properties from the uploaded file into the $data
array? Am I supposed to use a hidden form field or is there a better way?7 Replies
What I have so far:
I tried
$set('size', $state->getSize())
but it didn't work, I'm assuming because there is no $size
property on the component.I don’t think the state at this point is the TemporaryFileUpload. dd($state) to check.
it is
I would expect ->getSize() to work then.
But yea. You can $set a form field that doesn’t exist.
Wait you can? I tried and didn't get anything in the
$data
array.Not following what does $state have to do with $data. They are 2 completely different things.
Isn't the $data array what is saved to the database? Sorry maybe I'm confused. I was just dumping it out of
->action(fn ($data) => ray($data))