如何在Laravel 5.4中编辑php设置以接受较大的csv文件上传? [英] how to edit php settings in Laravel 5.4 to accept large csv file uploads?

查看:69
本文介绍了如何在Laravel 5.4中编辑php设置以接受较大的csv文件上传?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在本地php.ini中更改最大文件上传大小,但在Laravel 5.4中无法这样做. 我要上传4mb的csv文件.

I can change max file upload size in php.ini in my local but unable to do the same in Laravel 5.4. I want to upload 4mb csv file.

推荐答案

您需要同时配置Web服务器和PHP以允许上传较大的文件. 对于PHP,您需要配置 upload_max_filesize

You need to configure both your webserver and PHP to allow larger file uploads. For PHP you'll want to configure upload_max_filesize and post_max_size to the size you. E.g.:

upload_max_filesize = 5M
post_max_size = 8M

对于NGINX,您需要配置 client_max_body_size ,对于Apache,您需要配置 LimitRequestBody .

For NGINX you'll want to configure client_max_body_size, and for Apache you'll want to configure LimitRequestBody.

您的网络服务器配置中还有其他几个配置选项,这些选项可能会阻止上传较大的文件.请参阅您的网络服务器手册,以了解如何正确配置这些值.

There are also several other configuration options in your webserver config which could prevent the upload of larger files. Please see the manual of your webserver for how to configure those values correctly.

请注意,配置完这些设置后,您将要重新启动PHP和Web服务器.

Note that after configuring these settings you'll want to restart both PHP and your webserver.

这篇关于如何在Laravel 5.4中编辑php设置以接受较大的csv文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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