Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an one question about nginx upload module and file names:

2013/02/05 21:01:55 [info] 23432#0: *5 started uploading file "kvm.pdf" to "/var/www/html/0000000004" (field "file[]", content type "application/pdf"), client:, server: , request: "POST /upload/share?X-Progress-ID=0520d308f3b8c4ee5d03b20301416031 HTTP/1.1", host: "localhost", referrer: "***/upload/share?X-Progress-ID=4113dd986661cafbb8cfeede98d9dba2"
2013/02/05 21:01:55 [info] 23432#0: *5 finished uploading file "kvm.pdf" to "/var/www/html/0000000004", client:, server: , request: "POST /upload/share?X-Progress-ID=0520d308f3b8c4ee5d03b20301416031 HTTP/1.1", host: "localhost", referrer: "***/upload/share?X-Progress-ID=4113dd986661cafbb8cfeede98d9dba2"

I've uploaded file kvm.pdf but it was saved as 0000000004, which is not a good idea. Can it be changed to store files with original names?

upload_set_form_field $ "$upload_file_name";
upload_set_form_field $upload_field_name.content_type "$upload_content_type";

This lines included in config but it isn't working.

share|improve this question
up vote 0 down vote accepted

You're not using the upload module correctly. From the upload module documentation:

The module parses request body storing all files being uploaded to a directory specified by upload_store directive. The files are then being stripped from body and altered request is then passed to a location specified by upload_pass directive, thus allowing arbitrary handling of uploaded files. Each of file fields are being replaced by a set of fields specified by upload_set_form_field directive. The content of each uploaded file then could be read from a file specified by $upload_tmp_path variable or the file could be simply moved to ultimate destination.

The upload module takes care of the actual upload of the file data, but then passes control to another location (which you provide) which takes care of actually processing the uploaded data. The 0000000004 file is temporary -- if you want to permanently store the uploaded files you must provide a script which moves that temporary file to its final location. You can name the file whatever you want in that script.

share|improve this answer
Ok, thanks man, now im understand. – Valintinr Feb 5 '13 at 19:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.