Skip to navigation
How to uplaod a file with rails ruby?
07.12.13
1. In the View create a form: Upload
2. In the Controller save the file into server than load it into a file object. File.open("#{RAILS_ROOT}/public/html/" + params[:book_file].original_filename + ".html", "w") { |f| f.write(params[:book_file].read) } @f = File.new("#{RAILS_ROOT}/public/html/" + params[:book_file].original_filename + ".html", "r") end
Reply
Anonymous
How to uplaod a file with rails ruby?
1. In the View create a form: Upload
2. In the Controller save the file into server than load it into a file object. File.open("#{RAILS_ROOT}/public/html/" + params[:book_file].original_filename + ".html", "w") { |f| f.write(params[:book_file].read) } @f = File.new("#{RAILS_ROOT}/public/html/" + params[:book_file].original_filename + ".html", "r") end
07.12.13
Reply
Anonymous
Information Epoch 1732373452
Make your computer work for you, instead of you working for the computer.
Home
Notebook
Contact us