title: Cannot upload file
body: <p>I have problems to upload a file:</p>
  
  <p>Here is my html:</p>
  
  <pre><code>&lt;%= form_tag import_test_path, multipart: true do %&gt;
   &lt;%= file_field_tag :file, :style =&gt; 'display:inline; margin-top:-10px' %&gt;
   &lt;%= submit_tag 'Hochladen', :class =&gt; 'btn btn-sm btn-info' %&gt;
  &lt;% end %&gt; 
  </code></pre>
  
  <p>First i tried to simply upload it and to handle it in my controller like this:</p>
  
  <pre><code>  def import
      widgets = DBF::Table.new(params[:file], nil, 'cp1252')
      w = widgets.find(6)
      p = Patient.new
      p.vorname = w.vorname
      p.name = w.name
      p.geburtsdatum = w.geburt
      p.save
      respond_to do |format|
       format.html {redirect_to :back }
      end  
    end
  </code></pre>
  
  <p>But this provoced an error:</p>
  
  <pre><code> no implicit conversion of ActionDispatch::Http::UploadedFile into String
   in line: DBF::Table.new(params[:file], nil, 'cp1252')
  </code></pre>
  
  <p>Next i tried to generate first an Tempfile:</p>
  
  <pre><code>def import
      file = Tempfile.new(params[:file])
      widgets = DBF::Table.new(file, nil, 'cp1252')
      w = widgets.find(6)
      p = Patient.new
      p.vorname = w.vorname
      p.name = w.name
      p.geburtsdatum = w.geburt
      p.save
      respond_to do |format|
       format.html {redirect_to :back }
      end  
    end
  </code></pre>
  
  <p>But this also proved an error:</p>
  
  <pre><code> unexpected prefix_suffix: #&lt;ActionDispatch::Http::UploadedFile:0x6793d10 @tempfile=#  &lt;Tempfile:C:/Users/EMMANU~1/AppData/Local/Temp/RackMultipart20131110-6816-ogkd3i&gt;, @original_filename="patient.DBF", @content_type="application/octet-stream", @headers="Content-Disposition: form-data; name=\"file\"; filename=\"patient.DBF\"\r\nContent-Type: application/octet-stream\r\n"&gt;
   in line: file = Tempfile.new(params[:file])
  </code></pre>
  
  <p>What do i wrong? Thanks and have a nice day!</p>