网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站设计 > PHP
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   IP: 114.238.173.71
Old 2014-11-27, 01:33 PM
New Jersey New Jersey is offline
初级会员
 
Join Date: 2013-04-08
Posts: 1
New Jersey 现在声名狼藉
Default php上传大文件设置

有些朋友要通过自己的网站后台,包括论坛,来上传一些文件,php一般为2m,或8m(以下我们按默认为2m),接下来就是来讲怎么修改上传文件大小的。

1.首先修改执行上传文件限制

一般的文件上传,除非文件很小.就像一个5M的文件,很可能要超过一分钟才能上传完.
但在php中,默认的该页最久执行时间为 30 秒.就是说超过30秒,该脚本就停止执行.
这就导致出现 无法打开网页的情况.这时我们可以修改 max_execution_time

在php.ini里查找
max_execution_time
默认是30秒.改为
max_execution_time = 0
0表示没有限制

另一种方法是可以在php程序中加入
set_time_limit();
来设定页面最久执行时间.
set_time_limit(0);//0表示没有限制

2.其次修改数据包的最大限制

修改 post_max_size 设定 POST 数据所允许的最大大小。此设定也影响到文件上传。
php默认的post_max_size 为2M.如果 POST 数据尺寸大于 post_max_size $_POST 和 $_FILES superglobals 便会为空.
查找 post_max_size .改为
post_max_size = 150M

3. 最好修改上传文件的最大限制

很多人都会改了第二步.但上传文件时最大仍然为 2M.
为什么呢.我们还要改一个参数upload_max_filesize 表示所上传的文件的最大大小。
查找upload_max_filesize,默认为8M改为
upload_max_filesize = 100M

另外要说明的是,post_max_size 大于 upload_max_filesize 为佳
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:08 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.