Chetra
Chetra

Reputation: 31

Upload Image in Rails Without Model

How to upload Image in rails without use Model. I just want to use simple php to upload.

Upvotes: 2

Views: 2460

Answers (2)

vajapravin
vajapravin

Reputation: 1383

Upload file in rails without model creation

http://easyrails.herokuapp.com/blogs/5/upload-file-in-rails-without-model-creation

Upvotes: -1

Kevin Sylvestre
Kevin Sylvestre

Reputation: 38012

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 %>

Upvotes: 2

Related Questions