Search code examples
laravel-5file-upload

mime type of uploading file is application/octet-stream fails


I have a form for uploading pdf document and am using laravel validation in my controller like,

$validator = Validator::make($request->all(), [
       'document' => 'required|mimes:jpeg,jpg,png,pdf|max:25600',
]);

some of the images and pdf documents mime types like application/octet-stream

is there any way to check that application/octet-stream file mime is png, jpeg or pdf file ?


Solution

  • I've got the same problem, it wasn't a Laravel issue.

    I fixed this modifying

    php.ini

    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 10M ; from 5M to 10M
    
    ; Must be greater than or equal to upload_max_filesize
    post_max_size = 10M  ; from 5M to 10M