imwebby's avatar

5.3 - mp4 files not recognized at upload

Hi, I am trying to validate an mp4 file upload. The same form also successfully validates image and webm files, but either the server, or something I am doing wrong is causing laravel 5.3 to not recognizing the mp4 file extension/mime. I running on a dev machine using - mac OS Sierra, MAMP pro php7.10. did a dd and actually do see the file type in the filebag:

/// "filemp4" => UploadedFile {#30 ▼ -test: false -originalName: "1A.mp4" -mimeType: "video/mp4" -size: 4136884 ///

However the error: The filemp4 must be a file of type: video/mp4 is always returned. All the other file types validate, and I have manually verified that the apache.conf does have support for mp4 videos.

the only thing 'custom' I am doing is triggering a set of rules based on whether or not a file exists in the form post.

I have tried both using 'mimes' and 'mimetypes' and get the same result. I am wondering if this is a coding issue or a server configuration issue?

below are the rules in my request file: ///

{

    if (request()->hasFile('filemp4')) { 

       return [

        'title' => 'required|min:5',
        'description' => 'required|min:5',
        'body' => 'required|min:5',
        'filemp4' => 'required|mimes:mp4',
        'filewebm' => 'required|mimes:webm',
        'poster' => 'required|image',
        'date' => 'required|date',

        ]

    } else {

        return [

        'title' => 'required|min:5',
        'description' => 'required|min:5',
        'body' => 'required|min:5',
        'date' => 'required|date',

        ];

    }         

}

///

Thanks

0 likes
2 replies
mstralka's avatar

Did you figure this out? I'm having the same problem with MP4 files.

imwebby's avatar

unfortunately no, I could not get it to work on either my local dev machine or my production server, so I just had to not validate on the file type.

others have stated they think it was an environmental issue but I had the same problem on two different machines (mac mini with MAMP & centos WHM running custom set up php7)

hopefully you will have better luck!

Please or to participate in this conversation.