Upload Image in Rails Without Model
How to upload Image in rails without use Model. I just want to use simple php to upl开发者_开发技巧oad.
In Rails you will run all your server code in Ruby, not PHP. To create a file upload do the following:
> rails g controller uploader
# app/controller/uploader_controller.rb
def create
@file = params[:file]
end
# app/views/uploader/new.html.erb
<%= form_tag(uploader_path, multipart: true) do |form| %>
<%= file_field_tag "file" %>
<%= submit_tag %>
<% end %>
Upload file in rails without model creation
http://easyrails.herokuapp.com/blogs/5/upload-file-in-rails-without-model-creation
精彩评论