'jpg', 'image/png' => 'png', 'image/webp' => 'webp', 'image/gif' => 'gif', 'image/svg+xml' => 'svg', 'image/x-icon' => 'ico', 'image/vnd.microsoft.icon' => 'ico', 'font/woff2' => 'woff2', 'application/font-woff2' => 'woff2', ]; /** * @param list $types erlaubte MIME-Typen */ public static function apply(FileUpload $upload, array $types = self::IMAGES, ?string $forcedExtension = null): FileUpload { return $upload ->acceptedFileTypes($types) ->getUploadedFileNameForStorageUsing(fn (TemporaryUploadedFile $file) => self::name($file, $forcedExtension)); } public static function name(TemporaryUploadedFile $file, ?string $forcedExtension = null): string { $extension = $forcedExtension ?? self::EXTENSIONS[strtolower((string) $file->getMimeType())] ?? 'bin'; return Str::ulid().'.'.$extension; } }