<div dir="ltr">This is more of a rails standard than a ruby standard, but shouldn't it be okay to send the form field to the app server as "photo[uploaded_data][name]", "photo[uploaded_data][content_type]", etc. instead of just "photo[name]", "photo[content_type]", etc? The bracketed values are usually used as attributes of a model, so you probably don't want to take a chance of mixing up the model attributes with the uploaded data's nginx attributes,<div>
<br></div><div>-tieg<br><br><div class="gmail_quote">On Mon, Aug 11, 2008 at 11:22 AM, Valery Kholodkov <span dir="ltr"><<a href="mailto:valery%2Bnginxen@grid.net.ru">valery+nginxen@grid.net.ru</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><br>
As far as I understand ruby ideology, field name templates like<br>
$<a href="http://upload_field_name.name" target="_blank">upload_field_name.name</a> cannot refer to a valid collection element.<br>
<br>
Therefore you have to alter your config in the following way:<br>
<br>
location /upload {<br>
# Pass altered request body to this location<br>
upload_pass /internalupload;<br>
<br>
# Store files to this location<br>
upload_store /tmp;<br>
<br>
# Set specified fields in request body<br>
upload_set_form_field "${upload_field_name}[name]" "$upload_file_name";<br>
upload_set_form_field "${upload_field_name}[content_type]"<br>
"$upload_content_type";<br>
upload_set_form_field "${upload_field_name}[path]" "$upload_tmp_path";<br>
<br>
upload_pass_form_field "^commit$|^photo\[title\]$";<br>
}<br>
<br>
And in your app change:<br>
<br>
<%= file_field "photo", "uploaded_data" %><br>
<br>
to<br>
<br>
<%= file_field_tag "photo", :id => "photo_uploaded_data" %><br>
<br>
Since I'm completely inexperienced in Ruby, there is still no guaranty<br>
that this is going to work.<br>
<br>
Also for security purposes declare your location /internalupload as<br>
internal, so that no external requests to this location will be allowed:<br>
<br>
# Pass altered request body to a proxy<br>
location /internalupload {<br>
internal;<br>
proxy_pass <a href="http://thin_cluster" target="_blank">http://thin_cluster</a>;<br>
<div class="Ih2E3d"> }<br>
<br>
> Hi Valery, I've attached the config.<br>
><br>
> Very thanks for your time ;)<br>
<br>
<br>
--<br>
</div>Best regards,<br>
<font color="#888888">Valery Kholodkov<br>
<br>
<br>
</font></blockquote></div><br></div></div>