For the life of me, I just cannot figure out how to allow m4a audio file to pass through with laravel validation
$this->validate($request,[
'audio' => 'required|mimes:mpga,mp3,mp4a,aac,m4a'
]);
The mp3, mpeg files can be uploaded successfully, but just keep rejecting m4a.
Anyone know which mime type should I include?
To be clear, I'm looking for the guess extension of Audio/x-m4a. All of these (m4a, mp4a, mp4, aac) does not seem to work.
Thanks
For Laravel 5.4, try this: Change
mimes
tomimetypes
and useaudio/x-m4a
instead ofm4a
.If you
dd
the file mime type like$this->file('contract_copy')->guessExtension();
it will return something"mp4a"
form4a
extension.So I think you need
mp4a
extension in validation instead ofm4a
like,For more: check the validator class file in
vendor\laravel\framework\src\Illuminate\Validation\Validator.php
there you can see how laravel validate against the mime-types.