问题描述
我可以在本地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 和 post_max_size 更改为您的大小.例如:
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文件上传?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!