现在的浏览器能够识别很多文件类型(txt,pdf,jpg…),并在浏览器中自动打开
location /upload {
add_header Content-Disposition "attachment;";
}
解决方法二
只处理指定目录下的文件
location ~^/somepath/(.*)$ {
add_header Content-Disposition "attachment; filename=$1";
alias "E:/apache-tomcat-7.0.32/webapps/upload/$1";
}