<div dir="ltr">This is more of a rails standard than a ruby standard, but shouldn&#39;t it be okay to send the form field to the app server as &quot;photo[uploaded_data][name]&quot;, &quot;photo[uploaded_data][content_type]&quot;, etc. instead of just &quot;photo[name]&quot;, &quot;photo[content_type]&quot;, etc? The bracketed values are usually used as attributes of a model, so you probably don&#39;t want to take a chance of mixing up the model attributes with the uploaded data&#39;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">&lt;<a href="mailto:valery%2Bnginxen@grid.net.ru">valery+nginxen@grid.net.ru</a>&gt;</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>
 &nbsp;location /upload {<br>
 &nbsp; &nbsp;# Pass altered request body to this location<br>
 &nbsp; &nbsp;upload_pass &nbsp; /internalupload;<br>
<br>
 &nbsp; &nbsp;# Store files to this location<br>
 &nbsp; &nbsp;upload_store /tmp;<br>
<br>
 &nbsp; &nbsp;# Set specified fields in request body<br>
 &nbsp; &nbsp;upload_set_form_field &quot;${upload_field_name}[name]&quot; &quot;$upload_file_name&quot;;<br>
 &nbsp; &nbsp;upload_set_form_field &quot;${upload_field_name}[content_type]&quot;<br>
&quot;$upload_content_type&quot;;<br>
 &nbsp; &nbsp;upload_set_form_field &quot;${upload_field_name}[path]&quot; &quot;$upload_tmp_path&quot;;<br>
<br>
 &nbsp; &nbsp;upload_pass_form_field &quot;^commit$|^photo\[title\]$&quot;;<br>
 &nbsp;}<br>
<br>
And in your app change:<br>
<br>
&lt;%= file_field &quot;photo&quot;, &quot;uploaded_data&quot; %&gt;<br>
<br>
to<br>
<br>
&lt;%= file_field_tag &quot;photo&quot;, :id =&gt; &quot;photo_uploaded_data&quot; %&gt;<br>
<br>
Since I&#39;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>
 &nbsp;# Pass altered request body to a proxy<br>
 &nbsp;location /internalupload {<br>
 &nbsp; &nbsp;internal;<br>
 &nbsp; &nbsp;proxy_pass &nbsp; <a href="http://thin_cluster" target="_blank">http://thin_cluster</a>;<br>
<div class="Ih2E3d"> &nbsp;}<br>
<br>
&gt; Hi Valery, I&#39;ve attached the config.<br>
&gt;<br>
&gt; 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>