验证doc docx类型文件时出现laravel 5.1错误 [英] laravel 5.1 error in validating doc docx type file

查看:207
本文介绍了验证doc docx类型文件时出现laravel 5.1错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我遇到了docx类型验证问题.我尝试过

$validator = Validator::make($request->all(), [
            'resume'   => 'mimes:doc,pdf,docx'
        ]);

它将无错误地上传pdf文件,但是每当我尝试上传docx文件时,它都会给出验证错误必须是以下类型的文件:doc,pdf,docx"'
任何想法

解决方案

感谢通过允许zip解决问题

$validator = Validator::make($request->all(), [
            'resume'   => 'mimes:doc,pdf,docx,zip'
        ]);

这是因为 https://en.wikipedia.org/wiki/Office_Open_XML

Hi i am facing a docx type validation problem. I tried

$validator = Validator::make($request->all(), [
            'resume'   => 'mimes:doc,pdf,docx'
        ]);

It will upload pdf file with no error but whenever i try to upload docx files it gives validation error 'must be a file of type: doc, pdf, docx'
any idea

解决方案

thanks solved it by allowing zip

$validator = Validator::make($request->all(), [
            'resume'   => 'mimes:doc,pdf,docx,zip'
        ]);

this is because https://en.wikipedia.org/wiki/Office_Open_XML

这篇关于验证doc docx类型文件时出现laravel 5.1错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆