nginx上传文件不使用后台代码

浏览:50日期:2022-06-28

问题描述

就是不使用PHP Python 等后台处理 仅仅把文件传到指定目录里

<html><head><title>Test upload</title></head><body><h2>Select files to upload</h2><form name='upload' method='POST' enctype='multipart/form-data' action='/upload'><input type='file' name='file1'><br><input type='file' name='file2'><br><input type='file' name='file3'><br><input type='file' name='file4'><br><input type='file' name='file5'><br><input type='file' name='file6'><br><input type='submit' name='submit' value='Upload'><input type='hidden' name='test' value='value'></form></body></html>

就是用这个一个简单的页面上传 然后nginx直接指定一个路径存起来就行 不再做后台处理

问题解答

回答1:

nginx本身应该是不支持的,而且nginx原生不支持cgi,所以看样子,要么你得写个nginx的插件来做这件事情,要么就还是上fastcgi吧。这里有个简单的guide,让你把nginx配置成“支持cgi”:http://wiki.nginx.org/SimpleCGI

回答2:

我觉得不能吧,因为你得完成文件流的传送,你这个单一个HTML如何实现?

相关文章: