Issue with $this->form->getState() for Previewing Resume

When I use $this->form->getRawState();, everything works fine except I can't get the file upload URL. But if I switch to $this->form->getState(), I can get the URL, but it also validates every form field, which I don't want. How can I fix this so I can get the file upload URL without having to validate every form field? Any help would be awesome!
I have a similar issue as described in this question: https://www.answeroverflow.com/m/1152352566525566996
Using getRawState() returns an array for FileUpload - Filament
I use getRawState() in order to display previews within my blade view, but the only problem is that while getState() returns the correct string and URL for a $logo value/state, using getRawState() doesn't and causes issues. How would I fix this?
11 Replies
LeandroFerreira
LeandroFerreira9mo ago
Is the file upload a TemporaryUploadedFile?
mr_vjchauhan
mr_vjchauhanOP9mo ago
No @Leandro Ferreira
No description
LeandroFerreira
LeandroFerreira9mo ago
I mean, in the $this->form->getRawState()
mr_vjchauhan
mr_vjchauhanOP9mo ago
its return this object when i upload image if i am using $this->form->getRawState() and 2nd screenshot its already saved in database then return this value. I tried array_values($data['profile_photo']); when already saved in database
No description
No description
LeandroFerreira
LeandroFerreira9mo ago
Sorry, I didn't understand what is the issue..
mr_vjchauhan
mr_vjchauhanOP9mo ago
ok sorry @Leandro Ferreira did you read this https://www.answeroverflow.com/m/1152352566525566996 I have similar issue
Using getRawState() returns an array for FileUpload - Filament
I use getRawState() in order to display previews within my blade view, but the only problem is that while getState() returns the correct string and URL for a $logo value/state, using getRawState() doesn't and causes issues. How would I fix this?
LeandroFerreira
LeandroFerreira9mo ago
getState() will validate the form and process the uploads 🤷‍♂️
mr_vjchauhan
mr_vjchauhanOP9mo ago
which one is good for preview data with fileupload $this->form->getRawState() or $this->form->getState()
mr_vjchauhan
mr_vjchauhanOP9mo ago
Is it possible to get the TemporaryUploadedFile image path?
No description
LeandroFerreira
LeandroFerreira9mo ago
getPath(), getRealPath().. something like this
mr_vjchauhan
mr_vjchauhanOP9mo ago
@Leandro Ferreira thanks its $state->getRealPath()

Did you find this page helpful?