Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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: 127.0.0.1, 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: 127.0.0.1, 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_field_name.name "$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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.