开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜