F
Filament15mo ago
Adam

Image Uploading & S3 with Previews

Currently, I am able to get my uploaded images saved on my S3 Instances, however, I've noticed a handful of issues that go against the documentation: - Preserving filenames do not work. - There is no way to preview images after they've been uploads. - Images do not go to the desired bucket name (when specified). Below is my code:
FileUpload::make('featured_images')
->multiple() // Allows for multiple images
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp', 'image/tiff']) // Files types we'll accept
->preserveFilenames() // Ensure we keep the original file names
->disk('s3') // Save to our S3 Bucket
->directory('items')
->columnSpan(3),
FileUpload::make('featured_images')
->multiple() // Allows for multiple images
->acceptedFileTypes(['image/jpeg', 'image/png', 'image/webp', 'image/tiff']) // Files types we'll accept
->preserveFilenames() // Ensure we keep the original file names
->disk('s3') // Save to our S3 Bucket
->directory('items')
->columnSpan(3),
I've specified that i want to preserveFilenames() and that I want to send uploaded items to the items bucket via directory('items') Any clarification on this would be greatly welcomed.
1 Reply
Adam
AdamOP15mo ago
I came across ->visibility('private') and it seems this will show images once the form has been saved (or revisited). And oddly enough, adding that to the chain of methods seems to have fixed the issue with the images being uploaded to the wrong directory.
Want results from more Discord servers?
Add your server