F
Filament10mo ago
cmpDocs

Removing files from a record

Hi, i hope you all are fine! I need help please: when i'm going to edit a record that have a file attached, i cant remove it, just there is not a buttom to do it. What can i do? Thanks a lot!
19 Replies
toeknee
toeknee10mo ago
Please provide the code for the form.
cmpDocs
cmpDocsOP10mo ago
use Filament\Forms\Components\FileUpload; public static function form(Form $form): Form { return $form ->schema([ FileUpload::make('evidence') ->label('Evidencia fotográfica') ->multiple() ->preserveFilenames() ->columnSpanFull(), ]); }
toeknee
toeknee10mo ago
try ->deletable(true)
cmpDocs
cmpDocsOP10mo ago
No Sr., it doesn't work
No description
toeknee
toeknee10mo ago
Ok so you have the spinner you don't have access to load the file, that is the issue. check your network logs
cmpDocs
cmpDocsOP10mo ago
If i try ->openable() or ->downable() it work... I don´t understand!
Vp
Vp10mo ago
can you show the screenshot of "working", just curious
toeknee
toeknee10mo ago
It's It'll be a CORS issue right click, inspect youll see the console error.
cmpDocs
cmpDocsOP10mo ago
No description
cmpDocs
cmpDocsOP10mo ago
No description
cmpDocs
cmpDocsOP10mo ago
Thank you Sr., be more specific please!
cmpDocs
cmpDocsOP10mo ago
No description
toeknee
toeknee10mo ago
It's exactly as I said a CORS issue. You are loading the image over a different url to the application url. Browsers do not allow this natively from the headers in laravel. Check the url that is trying to load the image vs the url you are accessing filament through. Its usually http vs https
Vp
Vp10mo ago
You said "If i try ->openable() or ->downable() it work..." so curious to see how this is working in UI level (fileupload)
toeknee
toeknee10mo ago
Because it's a CORS issue, these both open the file directly and not embed into the website.
cmpDocs
cmpDocsOP10mo ago
How can i check this please? in the .env file?
toeknee
toeknee10mo ago
Do you not know how to use a browser console and network log inspection? The network logs in the browser inspection tools shows you the urls being called. Check the differences.
cmpDocs
cmpDocsOP10mo ago
i'm going to inspect this, and i'll be back later. At the moment i have to take my children to their school. Thanks a lot Sr.! Ok, i'm here again! I'm sorry if I bother you Sr. All i had to do was to add 'www' to the 'APP_URL' in the .env file... "It's usually about something insignificant" jejeje Have a nice day!
toeknee
toeknee10mo ago
Perfect.

Did you find this page helpful?