I have a form (Rails) which allows me to load a .csv file using the file_field. In the view:
file_field
<% form_for(:upcsv, :html => {:multipa
If your csv file doesn't fit to memory (can't use readlines), you can do:
def self.line_count(f) i = 0 CSV.foreach(f) {|_| i += 1} i end
Unlike wc -l this counts actual record count, not number of lines. These can be different if there are new lines in field values.
wc -l