I want to let admins import contacts via csv files into the database. Therefore I am using the ruby csv library and the following code snippet:
if request.post? && params[:file].present?
inputFile = params[:file].read
CSV.foreach(inputFile) do |row|
#save row here
end
end
However in CSV.foreach(inputFile) do |row| I get an "Errno::ENAMETOOLONG - File name too long"-error and the error message shows me that it uses the whole csv file as file name.
Does anyone know why it does that?
BTW: The csv file is using ',' and '/n' as delimiters.