Laravel max upload size limitations

2019-01-19 02:56发布

I have my website hosted at a shared server. The maximum upload limit is 5MB. All the validations and file uploading works fine if the uploaded file is under 5MB. But when a file greater than 5MB is uploaded, i see this enter image description here. How can I validate or force the file to be under the upload limit from server?

8条回答
别忘想泡老子
2楼-- · 2019-01-19 03:21

You can use Laravel validation rules:

 'image_file_input_name' => 'required|mimes:jpeg,bmp,png|size:5000',

size:value

The field under validation must have a size matching the given value. For string data, the value corresponds to the number of characters. For numeric data, the value corresponds to a given integer value. For an array, size corresponds to the count of the array. For files, size corresponds to the file size in kilobytes.

You can read more about validation and its usage.

查看更多
爷的心禁止访问
3楼-- · 2019-01-19 03:27

The 5 mb limitation is set by your webhost and likely cannot be changed.

To upload files larger than the limit you will have to upload it in parts.

A laravel package that does so: https://github.com/jildertmiedema/laravel-plupload

查看更多
登录 后发表回答