Upload Text File into a string


#1

I’m trying to upload a text file from a form and read the file into a
string in my rails app. I’ve tried using @import_file =
File.read(params[:import_file]) as well as File.open, but I need getting
“cannot convert StringIO into String” errors. Anyone have any ideas?

  • Kyle

#2

Have you tried

@import_file = params[‘import_file’].read