I've got two mp3
files, let's say file1.mp3
and file2.mp3
. When I upload file1 it is successfully uploaded but not the same for file2 failing with a wrong mimetype validation. The string for validating the input is:
$rules['arquivos.*'] = 'required|mimetypes:image/jpeg,image/png,image/gif,video/webm,video/mp4,audio/mpeg';
The html code for the form is:
{!! Form::open(['route' => 'posts.store', 'enctype' => 'multipart/form-data', 'class'=>'form-post']) !!}
<input class="novo-post-form-item form-post-file-input" name="arquivos[]" type="file" onchange="addNovoInputFile(this, {{ $configuracaos->num_max_arq_post }})">
// rest of the form
If I run the file and mimetype commands for both, it returns the EXACT same thing:
fabio@fabiopc:~$ mimetype ~/Music/file1.mp3
/home/fabio/Music/file1.mp3: audio/mpeg
fabio@fabiopc:~$ mimetype ~/Music/file2.mp3
/home/fabio/Music/file2.mp3: audio/mpeg
fabio@fabiopc:~$ file ~/Music/file1.mp3
/home/fabio/Music/file1.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 64 kbps, 44.1 kHz, Stereo
fabio@fabiopc:~$ file ~/Music/file2.mp3
/home/fabio/Music/file2.mp3: Audio file with ID3 version 2.4.0, contains: MPEG ADTS, layer III, v1, 64 kbps, 44.1 kHz, Stereo
So anyone knows what could be wrong this? Or it is a bug inside laravel validation part?
Edit: I've also found that this is also happening to some image files.