I'm trying to validate the file size and the mime type of an uploaded file (mp3 file) in laravel. But the validation only seem to kick in when I upload an image (gif, png). When I upload an mkv file with a size of 100Mb the validation seems to be ok with it. Here's my current code:
$file = Input::file('audio_file');
$file_rules = array('audio_file' => 'size:5242880|mimes:mp3'); //also tried mpeg
$file_validator = Validator::make(Input::file(), $file_rules);
if($file_validator->fails()){
//return validation errors
}else{
//always goes here and succeeds
}
Any ideas what's wrong with my code? Thanks in advance!