I am workng on video hosting website in laravel,
In form user can upload a video file
{{ Form::file('filename', isset($movie->filename) ? $movie->filename: Input::old('filename')) }}
my validator code is given below
$input = Input::all();
$validator = Validator::make($input,
array(
// other validations working fine
'filename' => 'required|mimes:video/mp4,video/x-flv,application/x-mpegURL,video/MP2T,video/3gpp,video/quicktime,video/x-msvideo,video/x-ms-wmv'
));
I have checked this and this
Even I have checked MIME type of a file for testing purpose via
dd(mime_content_type($_FILES['filename']['tmp_name']));
it returns video/mp4 , even it is in validation check. Moreover required validation is also working good. Then why Mime Type validtion not working fine ? Thanks
You should use mimes
validator rule like this:
'filename' => 'required|mimes:mp4,x-flv,x-mpegURL,MP2T,3gpp,quicktime,x-msvideo,x-ms-wmv'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With