F
Filamentβ€’10mo ago
[uS] Sira

Is it possible to preserve the original filename of a file uploaded via a RichEditor file attachment

Hi, I'm working on a panel that has a RichEditor that will be used to write articles containing downloadable PDFs, so I need to keep the original file names when uploading files via its file attachment utility. The default behavior is to rename the uploaded files with a random string. Thank you!
6 Replies
[uS] Sira
[uS] SiraOPβ€’10mo ago
Anyone?
awcodes
awcodesβ€’10mo ago
Have a look at the methods here. You should be able to modify them how you need to. https://github.com/filamentphp/filament/blob/3.x/packages/forms/src/Components/Concerns/HasFileAttachments.php
GitHub
filament/packages/forms/src/Components/Concerns/HasFileAttachments....
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
[uS] Sira
[uS] SiraOPβ€’10mo ago
Thank you for your reply! Can you help me a bit further? I don't know what I should modify or do to preserve the file's name using those methods. I can't find anything related to this on the official documentation too. Sorry if this is a noob question, I'm still learning!
awcodes
awcodesβ€’10mo ago
Pass in your own saving function in ->saveUploadedFileAttachmentsUsing()
ruimtcosta
ruimtcostaβ€’9mo ago
What parameters can I use on that method?
awcodes
awcodesβ€’9mo ago
Have a look at the underlying code in the vendor directory. If your IDE is setup properly it should tell you. You can also look at it on GitHub. 😁
Want results from more Discord servers?
Add your server