简体   繁体   English

使用PHP上传大文件

[英]Upload big file using PHP

I'm trying to upload big files using PHP and it's not working and the size is around 855 ko . 我正在尝试使用PHP上传大文件,但无法正常工作,大小约为855 ko I've already tried uploading smaller files and its worked so i'm sure that my problem that causing the error. 我已经尝试上传较小的文件,并且可以正常工作,所以我确定导致错误的问题。

I've already tried most of the solution in SO and google but in vain. 我已经在SO和google中尝试了大多数解决方案,但徒劳无功。 Some said that i should try to configure my php.ini and i did but without success. 有人说我应该尝试配置我的php.ini ,但我确实做了,但是没有成功。

I'm using lighttpd on an embedded system. 我在嵌入式系统上使用lighttpd

My php.ini configuration : 我的php.ini配置:

max_execution_time = 300; Maximum execution time of each script, in seconds
max_input_time = 25200; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 40M      ; Maximum amount of memory a script may consume (128MB)
file_uploads = On
upload_tmp_dir =/home/imagesdcard/www/
upload_max_filesize = 10M
max_file_uploads=2

I had tried many solutions that suggesting it was caused by certains configurations in php.ini and i had changed it but without success.So, i wanna ask how can i upload big files using php? 我尝试了许多解决方案,建议它是由php.ini的某些配置引起的,并且我对其进行了更改,但没有成功。所以,我想问一下如何使用php上传大文件?

Thank you in advance for all advice and help and have a great day. 预先感谢您提供的所有建议和帮助,并祝您度过愉快的一天。

By configuration, PHP only allows to upload files up to a certain size. 通过配置,PHP仅允许上传最大大小的文件。 There are lots of articles around the web that explain how to modify this limit. 网上有很多文章介绍了如何修改此限制。 Below are a few of them: 以下是其中一些:

For instance, you can edit your php.ini file and set: 例如,您可以编辑php.ini文件并设置:

memory_limit = 32M
upload_max_filesize = 24M
post_max_size = 32M

You will then need to restart apache. 然后,您需要重新启动apache。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM