ebess / advanced-nova-media-library

A Laravel Nova field for displaying, creating, updating and ordering a Spatie Media Library model.
591 stars 295 forks source link

Unable to upload audio files #237

Open HenryJBN opened 3 years ago

HenryJBN commented 3 years ago

Hi, Thanks for this awesome package. I encountered an issue while uploading files. I could successfully upload image files but when i attempted to upload an audio file, it threw an error. Kindly see attached screenshot. I had tried to use Media::make() instead of Files::make() but no headway. What do I need to change?

Thanks

Resource

`public function fields(Request $request) { return [ ID::make(('ID'), 'id')->sortable(), BelongsTo::make('Album')->showCreateRelationButton(function ($request) { return true; })->required(), Text::make(('Title'), 'title')->required(), Markdown::make('Description'), Text::make(__('Type'), 'type')->required(), Files::make('Upload Song', 'songs')->required(),

];

}`

Model

`class Song extends Model implements HasMedia { use InteractsWithMedia;

protected $fillable = ['album_id','title', 'description', 'type'];

public function album() { return $this->belongsTo(Album::class); }

public function registerMediaCollections(): void { $this ->addMediaCollection('songs') ->acceptsMimeTypes(['audio/mpeg','video/mpeg']) ->singleFile();

} } Screenshot at Jan 21 05-27-22 `

Rizayev commented 2 years ago

terminal --> php --ini /usr/local/etc/php/XX.0/php.ini

edit => php.ini

set upload_max_filesize = 200M post_max_size = 200M