title: Rails file upload error "undefined method `original_filename' for nil:NilClass"
body: <p>i have simple upload form:</p>
  
  <pre><code>&lt;%= form_for(:product, :url =&gt; {:action =&gt; 'update_product', :id =&gt; @product.id}, :html =&gt; {:multipart =&gt; true}) do |f| %&gt;
  &lt;%= f.file_field(:product_image) %&gt;
  &lt;%= submit_tag('Upload') %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>And in a controller:</p>
  
  <pre><code>def update_product
      product = Product.find(params[:id])
      if(product)
          uploaded_image = params[:product][:product_image]
          params[:product][:product_image] = uploaded_image.original_filename
          product.update_attributes(params[:product])
          flash[:notice] = "Successfully updated!"
          redirect_to :action =&gt; 'edit_product', :id =&gt; product.id
      end
  end
  </code></pre>
  
  <p>When i try to upload, i have an error "undefined method `original_filename' for nil:NilClass"
  What i'm doing wrong?</p>
  
  <p>I use Rails 3.0.10 and Ruby 1.9.2p290</p>