FileUpload as Base64 String
I need to save a ZIP in the DB. I would like to use the FileUpload in the form for this. How can I save a Base64 hash in the DB instead of the path of the file?
3 Replies
I think based on my 2 days of experience, you can use
->using(// Custom record creation logic)
and changing the file upload behavior to not store the file permanently. Documentation here : https://filamentphp.com/docs/3.x/forms/fields/file-upload#preventing-files-from-being-stored-permanentlyThat the files are not saved permanently I have already included, but then Filament automatically saves the Temp Storage path
You could use the
->using ()
or ->after()
lifecycle hooks to fetch the file, base code it and replace the entry in the column. However, temporary means temporary. The file might not be present in the directory after the complete cycle or part way through. Experiment with the lifecycle hooks and dd()