laravel 上传文件验证类型时,docx文件无法通过验证
request 文件如下
<?php
namespace App\Http\Requests\Api;
use Illuminate\Foundation\Http\FormRequest;
class FileRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'file' => 'required|file|mimes:jpg,jpeg,png,pdf,doc,docx,xls,xlsx,ppt,pptx,cdr,zip,rar,7z,bz2',
];
}
}
但是上传docx文件仍然无法通过验证,其它文件正常。
推荐文章: