Skip to content

Instantly share code, notes, and snippets.

@davesherratt
Created October 17, 2012 12:18
Show Gist options
  • Save davesherratt/3905237 to your computer and use it in GitHub Desktop.
Save davesherratt/3905237 to your computer and use it in GitHub Desktop.
def upload
ajax_upload = params[:qqfile].is_a?(String) # either a file name (set) or a file (NOT SET, but qqFileUploader allows for it)
filename = ajax_upload ? params[:qqfile] : params[:qqfile].original_filename
if ajax_upload
csv_source = request.body.read
else
csv_source = params[:qqfile].read
end
tmp_file = "#{Rails.root}/data/tmp-#{cookies[:remember_token]}.csv"
csv_valid = false
parsed_csv = CSV.parse(csv_source)
if parsed_csv
csv_valid = true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment