# Problem using FasterCSV on Import: Can't convert Tempfile to string

**URL:** <https://www.ruby-forum.com/t/problem-using-fastercsv-on-import-cant-convert-tempfile-to-string/188326>\
**Category:** Rails\
**Created:** [May 10, 2010, 10:56am UTC](https://www.ruby-forum.com/t/problem-using-fastercsv-on-import-cant-convert-tempfile-to-string/188326 "2010-05-10T10:56:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kryptyk\_Fysh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecc23a/32.png) [@Kryptyk\_Fysh](https://www.ruby-forum.com/u/Kryptyk_Fysh)\
**Post date:** [May 10, 2010, 10:56am UTC](https://www.ruby-forum.com/t/problem-using-fastercsv-on-import-cant-convert-tempfile-to-string/188326/1 "2010-05-10T10:56:01Z")

</div>

Hi,

I’m trying to import a CSV file using fasterCSV and keep getting this  
error when trying to import the file.

The parameters are passed from this view:

\<% form\_for :dump, :url =\> { :controller =\> ‘mots’, :action =\>  
‘mot\_csv\_import’ }, :html =\> { :multipart =\> true } do |f| %\>

\<%= f.label :file, 'Select file to import' %\>  
 \<%= f.file\_field :file -%\>

\<%= submit\_tag "Submit" %\>

\<% end %\>

To this action:

def mot\_csv\_import  
header\_row = true  
row\_number = 0  
FasterCSV.foreach(params[:dump][:file]) do |row|  
if not header\_row  
Mot.create(  
:vrm =\> row[4],  
:is\_active =\> 0,  
:is\_new =\> 1)  
row\_number += 1  
GC.start if row\_number%50 == 0  
header\_row = nil  
end  
end  
redirect\_to :controller =\> ‘mots’, :action =\> ‘index’  
end

Can anyone advise me where I’m going wrong, please?
