只是关于Laravels验证器的查询.我的网站的用户将在可能大约100MB标记的时间上传文件.
我看过了:http://laravel.com/docs/4.2/validation
我的控制器代码如下:
$rules = array(
'file' => 'max:102400'
);
102400相当于100MB,我觉得文档对此不够清楚吗?
解决方法:
如文档中所述:
max:value
The field under validation must be less than or equal to a maximum
value. Strings, numerics, and files are evaluated in the same fashion
as the size rule
所以我们转到尺寸规则:
size:value
The field under validation must have a size matching the given value.
For string data, value corresponds to the number of characters. For
numeric data, value corresponds to a given integer value. For files,
size corresponds to the file size in kilobytes.
所以102400是Kilobytes.
是的,这是100 MB.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。