Uploading images in Production

Hi.

I am trying to upload images to my app in production. I can see the images being stored in the livewire-tmp folder but when Its trying to save it to the public disk, It throws me a 500 error. Below is my code and the response and errors.

Code:
class ListGalleryImages extends ListRecords
{
    protected static string $resource = GalleryImageResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\Action::make('upload')
                ->label('Upload Images')
                ->form([
                    Forms\Components\FileUpload::make('images')
                        ->disk('public')
                        ->directory('gallery')
                        ->multiple()
                        ->getUploadedFileNameForStorageUsing(
                            fn(TemporaryUploadedFile $file): string => Str::uuid()->toString() . '.' . $file->getClientOriginalExtension(),
                        )
                        ->storeFileNamesIn('file_original_name')
                ])
                ->closeModalByClickingAway(false)
                ->action(function (array $data) {
                    $images = $data['images'];
                    $originalNames = $data['file_original_name'];

                    foreach ($images as $image) {
                        GalleryImage::query()->create([
                            'file_path' => $image,
                            'file_original_name' => $originalNames[$image],
                            'file_name' => explode('/', $image)[1],
                        ]);
                    }
                })
        ];
    }
}


Any help appreciated.

Thanks.
Screenshot_2024-02-25_at_21.31.41.png
Screenshot_2024-02-25_at_21.33.18.png
Was this page helpful?