Upload module help

hi,
i am using nginx upload module to upload files.i am running this in
ubuntu.when i upload files .its working fine .but name of the file is
something different .this is not taking the upload _set_form_field
values. i dont know what went wrong.here is my conf file below

plz help me if u know

worker_processes 20;

error_log logs/error.log notice;

working_directory /usr/local/nginx;

events {
worker_connections 1024;
}

http {
include mime.types;
default_type application/octet-stream;

server {
    listen       80;
    client_max_body_size 100m;

    # Upload form should be submitted to this location
    location /upload {
        # Pass altered request body to this location
        upload_pass   @test;

        # Store files to this directory
        # The directory is hashed, subdirectories 0 1 2 3 4 5 6 7 8

9 should exist
upload_store /tmp 1;

        # Allow uploaded files to be read only by user
        upload_store_access user:r;

        # Set specified fields in request body
        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;

        # Inform backend about hash and size of a file
        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 "^submit$|^description$";
    }

    # Pass altered request body to a backend
    location @test {
        proxy_pass   http://localhost:8080;
    }
}

server{
listen 8080;
}
}

Posted at Nginx Forum:

Hello,

you can try a small config like this:

 location /form {
     echo '<form action="/upload" enctype="multipart/form-data"

method=“post”>’;
echo ‘’;
echo ‘’;
echo ‘’;
}

 location /upload {
     upload_pass /script-to-process;
     upload_store /var/tmp;
     upload_store_access user:r;
     upload_set_form_field $upload_field_name.name 

“$upload_file_name”;
upload_set_form_field $upload_field_name.path
“$upload_tmp_path”;
upload_cleanup 400-505;
}

in your process script you get

$_POST[file_path] # this is the file with “something different”
$_POST[file_name] # this is your filename

Cheers,

Alexander

Am 23.03.2011 08:17, schrieb vetri:

Mr Alexander ,

  i tried ur config but it is showing echo is a unknown

directive.what is the problem with echo in the config.

 can i use echo really in the config like that?

and thanks for the reply

Posted at Nginx Forum:

Sorry, yes, echo is no build in option. But you can put this
code into a simple html file. This code shoud only show the
names for the formfields…

Am 23.03.2011 10:17, schrieb vetri:

mr alexander,

i am already using form to to upload files. my doubt is why its not
saving the file in uploaded file name.it is saving the file in number
form like this 0040353221 .i dont know why its happening and one more
question how to parse header using nginx configuration ?

thanks for the reply

Posted at Nginx Forum:

On Wed, Mar 23, 2011 at 5:17 PM, vetri [email protected] wrote:

Mr Alexander ,

 i tried ur config but it is showing echo is a unknown

directive.what is the problem with echo in the config.

The echo directive is provided by the ngx_echo module:

GitHub - openresty/echo-nginx-module: An Nginx module for bringing the power of "echo", "sleep", "time" and more to Nginx's config file

It’s very handy in debugging nginx.conf stuffs :wink:

Cheers,
-agentzh

vetri wrote:

mr alexander,

i am already using form to to upload files. my doubt is why its not
saving the file in uploaded file name.it is saving the file in number
form like this 0040353221 .

This is because it’s a temporary file. Saving an uploaded file under the
original name is neither secure nor convenient.

Your script must take care of the permanent name for the file.

i dont know why its happening and one more
question how to parse header using nginx configuration ?


Best regards,
Valery K.

mr valery,
thanks for the information and i have given the
configuration above .could you tell me what went wrong.why its taking
the file as temporary file and i need configuration help to save the
file in real name.i need to know how to optimize the configuration

and thanks for the reply

Posted at Nginx Forum:

----- vetri [email protected] wrote:

mr valery,
thanks for the information and i have given the
configuration above .could you tell me what went wrong.why its taking
the file as temporary file and i need configuration help to save the
file in real name.

It is up to you to implement a script that does this job. Upload module
can save the content of the file fields only into temporary files.

i need to know how to optimize the configuration


Regards,
Valery K.

----- vetri [email protected] wrote:

mr valery,

is there any module to unzip ,checksum calculation for the uploaded
file?

Experimental version of upload module can unzip files:

Calculating CRC32 is possible with stable version.


Regards,
Valery K.

mr valery,

is there any module to unzip ,checksum calculation for the uploaded
file?

Posted at Nginx Forum: