for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Spatie\MediaLibrary\Exceptions\FileCannotBeAdded;
use Spatie\MediaLibrary\Helpers\File;
use Spatie\MediaLibrary\Exceptions\FileCannotBeAdded;
class FileIsTooBig extends FileCannotBeAdded
{
public static function create(string $path)
$fileSize = File::getHumanReadableSize(filesize($path));
$maxFileSize = File::getHumanReadableSize(config('medialibrary.max_file_size'));
return new static("File `{$path}` has a size of {$fileSize} which is greater than the maximum allowed {$maxFileSize}");
}