client_max_body_size 1024M
upload_limit_rate 158k
如下:
location /upload { upload_pass /up.php; upload_cleanup 400 404 499 500-505; #upload_store /data/app/test.local/upload_tmp; upload_store /tmp; upload_store_access user:r; client_max_body_size 1024M; upload_limit_rate 158k; upload_set_form_field "${upload_field_name}_name" $upload_file_name; upload_set_form_field "${upload_field_name}_content_type" $upload_content_type; upload_set_form_field "${upload_field_name}_path" $upload_tmp_path; upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5; upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size; upload_pass_form_field "^.*$"; #upload_pass_form_field "^pid$|^tags$|^categoryid$|^title$|^userid$|^user_id$|^is_original$|^upload_file_name$|^upload_file_content_type$|^upload_file_path$|^upload_file_md5$|^upload_file_size$"; }
2、修改php.ini
upload_max_filesize = 8M post_max_size = 10M memory_limit = 20M max_execution_time=300 file_uploads = On #默认允许HTTP文件上传,此选项不能设置为OFF。 upload_tmp_dir =/tmp/www
在上传大文件时,你会有上传速度慢的感觉,当超过一定的时间,会报脚本执行超过30秒的错误,这是因为在php.ini配置文件中 max_execution_time配置选项在作怪,其表示每个脚本最大允许执行时间(秒),0 表示没有限制。你可以适当调整max_execution_time的值,不推荐设定为0。
总结
以上所述是小编给大家介绍的PHP 文件上传限制问题,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!