This is the documentation for
v7 but the latest version is
v10
.
You can switch versions in the menu on the left/at the top.
Check your current version with the following command:
composer show spatie/laravel-medialibrary
By default all files are stored on the disk specified as the disk_name
in the config file.
Files can also be stored on any filesystem that is configured in your Laravel app. When adding a file to the media library you can choose on which disk the file should be stored. This is useful when you have a combination of small files that should be stored locally and big files that you want to save on S3.
toMediaCollection
accepts a disk name as a second parameter:
// Will be stored on a disk named s3
$newsItem->addMedia($pathToAFile)->toMediaCollection('images', 's3');