laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.51k stars 11.02k forks source link

Validation mimetypes doesn't work with 3gp files #25131

Closed lafriakh closed 5 years ago

lafriakh commented 6 years ago

Description:

Validation not passed when i upload 3gp videos. My form request file:

    public function rules()
    {
        return [
            'title' => 'required',
            'video' => 'required|file|mimetypes:video/mp4,video/mpeg,video/x-matroska,video/x-flv,video/quicktime,video/x-msvideo,video/x-ms-wmv,video/x-m4v,video/3gpp,video/3gpp2',
        ];
    }

Steps To Reproduce:

When i try to get the file mime type via $request->getMimeType() it's return application/octet-stream.

jmarcher commented 6 years ago

And what the file mime type? To find out:

Windows (I believe this info is under the file properties) Linux and MacOS: file <filename> -i

driesvints commented 5 years ago

If this is an actual issue then this is most likely an issue with Symfony's ExtensionGuesser and not with Laravel: https://github.com/laravel/framework/issues/26511

alenija commented 4 years ago

Try to add 'enctype' => "multipart/form-data" in form