zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Nginx的Upload上传模块

2023-09-27 14:29:31 时间

重启nginx即可
以下是我的nginx配置文件

前端页面提交的时候直接提交到 http://test.local/upload 即可


                upload_set_form_field "${upload_field_name}_content_type" $upload_content_type;
                upload_aggregate_form_field "${upload_field_name}_md5" $upload_file_md5;
                upload_aggregate_form_field "${upload_field_name}_size" $upload_file_size;
upload_set_form_field 设定额外的表单字段。这里有几个可用的变量: $upload_file_name 文件原始名字 $upload_field_name 表单的name值 $upload_content_type 文件的类型 $upload_tmp_path 文件上传后的地址 upload_aggregate_form_field 额外的变量,在上传成功后生成 $upload_file_md5 文件的MD5校验值 $upload_file_size 文件大小 upload_pass_form_field 从表单原样转到后端的参数,可以正则表达式表示 官方的例子是upload_pass_form_field "^submit$|^description$";意思是把submit,description这两个字段也原样通过upload_pass传递到后端php处理。如果希望把所有的表单字段都传给后端可以用upload_pass_form_field "^.*$";