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.


location /umtest {
            upload_pass /nginx_response;
            set $upload_store '';
            rewrite_by_lua '
                local header = ngx.req.raw_header()
                ngx.say("type header",header)
                dst_path_dir = ngx.req.get_headers()["Dst-Dir"]
                ngx.say("dst_path_dir",dst_path_dir)
                ngx.var.upload_store = dst_path_dir
                ngx.say("upload store path" ,ngx.var.upload_store)    
             ';
                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_cleanup 400 404 499 500-505;
               }


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?
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to