Forum: Ruby on Rails Upload Text File into a string

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5dd60445347fc3dec62474cc732fef0d?d=identicon&s=25 Kyle Mathews (kylemathews)
on 2006-02-21 00:17
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
E637601d734376a9ac9f64606e56dc92?d=identicon&s=25 Richard Hart (Guest)
on 2006-02-21 00:28
(Received via mailing list)
Have you tried

@import_file = params['import_file'].read
This topic is locked and can not be replied to.