安装
#wget -O nginx-upload-module.tar.gz https://github.com/vkholodkov/nginx-upload-module/archive/2.2.0.tar.gz #tar zxvf nginx-upload-module.tar.gz 重新编译nginx --add-module=指定模块目录
nginx配置
location /upload { upload_pass /test.php; upload_store /tmp/nginx_upload; upload_store_access user:rw; 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_cleanup 400 404 499 500-505; } location ~ \.php$ { try_files $uri =404; include fastcgi.conf; fastcgi_pass 127.0.0.1:9000; fastcgi_param env development; }
上传页面
<html> <body> <h2>Select files to upload</h2> <form name="upload" method="POST" enctype="multipart/form-data" action="http://114.215.142.108:8080/upload"> <input type="file" name="file1"><br> <input type="file" name="file2"><br> <input type="file" name="file3"><br> <input type="submit" name="submit" value="Upload"> <input type="hidden" name="test" value="value"> </form> </body> </html>
后端处理test.php
<?php for($i=1; $i<=3; $i++) { if (isset($_POST["file{$i}_path"]) && $_POST["file{$i}_name"] && $_POST["file{$i}_md5"]) { $src = $_POST["file{$i}_path"]; $md5 = $_POST["file{$i}_md5"]; $dir = '/tmp/'.substr($md5, 0, 2); $dest = $dir.'/'.$_POST["file{$i}_name"]; if (!is_dir($dir)) { mkdir($dir, 0777); } rename($src, $dest); } }
流程:
nginx接收到请求,保存到配置文件指定位置,然后使用php做后续处理。
配置说明
http://wiki.nginx.org/HttpUploadModule
相关推荐
包含upload-module的nginx-1.21.6,针对windows平台64位的编译的二进制(exe)文件。 为了upload-module能在window平台编译通过,进行部分代码修改,修改内容详见https://github.com/chnykn/bimface
nginx-upload-progress模块源码,用于nginx配置获取文件上传进度。
nginx-upload-module模块源码,用于nginx配置文件上传功能
我用nginx1.8.0,编译nginx upload模块的时候报有些函数和成员找不到(upload不兼容新版本的nginx),后来在网上找了解决方法,将打好的包上传到这里。亲测可用。
也是IMAP/POP3/SMTP代理服务器,是由俄罗斯人lgor Sysoev开发,支持模块加载和卸载,其中upload_module和upload_progress_module就是第三方开发的模块,并没有加入到Nginx的源码中,upload_module是上传文件到服务器...
Nginx上传模块该模块基于Nginx上传模块(v 2.2.0) 。 ...由于似乎作者没有维护该模块。 我更改了一些可以与最新的nginx一起安装的代码。 安装./configure --add-module = {module_dir} && make &&进行安装conf ...
nginx-upload-progress-module 是 Nginx 的文件上传时支持进度显示的扩展模块。 标签:nginx
用于Nginx交叉编译源码包,实现RTMP/HTTP推流、nginx反向代理、文件上传等功能。...4、nginx-upload-module-master 5、nginx-upload-progress-module 6、openssl-1.1.0l 7、pcre-8.44 8、zlib-1.2.11
nginx1.16版本 后端节点健康检查、自动隔离+nginx_upstream_check_module-master+nginx-upload-module
nginx-upload-module-master模块,用户nginx 上传文件。
nginx的文件上传模块
nginx安装文件上传ngx_upload模块教程.docx
为OpenResty增加nginx_upload_module模块-附件资源
jquery-upload-progress, 上传进度栏使用 apache Nginx 和lighttpd上传进度模块 它可以与apache上传进度模块,Nginx 上传进度模块或者lighttpd一起使用,在这里阅读更多: ...
Nginx上传模块 的模块,用于使用多部分/表单数据编码( )处理文件上载以及根据协议进行的可恢复上载。 描述 该模块解析请求正文,该请求正文存储所有要上传到由指令指定的目录中的文件。 然后将文件从正文中剥离,...
安装水龙头后,您可以安装带有可选nginx-full : brew tap denji/nginxbrew install nginx-full --with-upload-module有关可用配置选项的列表,请运行: brew options nginx-fullbrew info nginx-full那冲突呢?...
nginx的文件上传获取实时进度条模块
1.17.0不再支持OpenSSL 0.98,limit_rate/proxy_upload_rate支持变量。 请参考: 当前状态 Nginx 1.20.0 Git分支 分支 说明 注释 master Nginx开发版1.20.0 有 mainline Nginx开发版1.20.0 无 stable Nginx稳定版...