2011-03-25 08:24:59 1 评论 PHP Boy.Lee

设置 php.ini 上传文件

{Basic Change}

  1. file_uploads = on ;
  2. upload_tmp_dir ;//maybe you don't need to change this
  3. upload_max_filesize = 8m ; //from 2m to 8M or bigger
  4. post_max_size = 8m ;

如果需要上传较大文件, 同时修改下面的参数

 

{Advantage Change}

  1. max_execution_time = 600 ;
  2. max_input_time = 600 ;
  3. memory_limit = 8m ;//the amount of memory every page can use.

 

{Final List}

max_execution_time = 600
max_input_time = 600
memory_limit = 32m
file_uploads = on
upload_tmp_dir = /tmp
upload_max_filesize = 32m
post_max_size = 32m

 

简单的说,一般上传小于2M不用修改,2-8M简单修改(第一部分),大于8M复杂修改,增加执行时间这些。应该是越来越不安全。