<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<style>
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
</style>
<div style="font-family:Helvetica,Helvetica,微软雅黑, 宋体; line-height:1.6;">
<div></div>
<style>
font{
line-height: 1.6;
}
ul,ol{
padding-left: 20px;
list-style-position: inside;
}
</style>
<div style="font-family:Helvetica,Helvetica,微软雅黑, 宋体; line-height:1.6;">
<div>I am using nginx upload module for uplaoding files to server. But I wanted nginx to upload to different paths, not to a path mentioned in upload_store. So I am taking help of nginx-lua module to change the upload_store value on each request like below.</div><div><br></div><div>location /umtest {</div><div> upload_pass /nginx_response;</div><div> set $upload_store '';</div><div> rewrite_by_lua '</div><div> local header = ngx.req.raw_header()</div><div> ngx.say("type header",header)</div><div> dst_path_dir = ngx.req.get_headers()["Dst-Dir"]</div><div> ngx.say("dst_path_dir",dst_path_dir)</div><div> ngx.var.upload_store = dst_path_dir</div><div> ngx.say("upload store path" ,ngx.var.upload_store) </div><div> ';</div><div> upload_set_form_field $upload_field_name.name </div><div> "$upload_file_name";</div><div> upload_set_form_field $upload_field_name.content_type </div><div> "$upload_content_type";</div><div> upload_set_form_field $upload_field_name.path </div><div> "$upload_tmp_path"</div><div> upload_cleanup 400 404 499 500-505;</div><div> }</div><div><br></div><div>Now when I POST to the '/umtest' it will change the upload_store value, but it will not execute the nginx upload direcives (i.e., upload will not happen). When I comment the rewrite_by_lua directive , the upload happens. My question is cant we use both at a same time to achieve the purpose?</div>
</div><!--�-->
</div>
</body>
</html>