How to parse an uploaded txt file in Rails3

Posted by gkaykck on Stack Overflow See other posts from Stack Overflow or by gkaykck
Published on 2011-02-19T20:31:39Z Indexed on 2011/02/20 7:25 UTC
Read the original article Hit count: 219

I have a form which have a file input;

<%form_tag '/dboss/newsbsresult' , :remote=>true do %>
    <input type="file" id="examsendbutton" name="txtsbs"/><br/>
    <input type="submit" value="Gonder">
<%end%>

Here i want the user to select a txt file which i try to parse and use at server, but i cannot catch the uploaded file with this code,

def newsbsresult
        @u = params[:txtsbs] #Or params[:txtsbs].to_s
        p @u
end

What is the true way of achieving this?

© Stack Overflow or respective owner

Related posts about html

Related posts about ruby-on-rails