views:

65

answers:

1

Hi, I'm new to rails. I want to know about file uploading process in rails. Can anyone please help me... Thanks, Althaf

+2  A: 

Usually gems/plugins are used to to handle file uploads. My favorite one, and perhaps the most ubiquitous is Paperclip.

In your view, you'll have to tell the rails form helpers that you're uploading a file like this:

<%= form_for @model, :html => { :multipart => true } do |form| %>
Jason stewart
@Jason stewart=>Thanks for your reply. I wanted to know the uploading code that is to be written in the controller and in model(if needed). I'm familiar with view part for file uploading
@user475748 dude u dont need to write any special lines of code for uploading the file. Paperclip plugin has those lines of code. Just follow the blogpost i provided in my answer and check that 5 mins railscast.
piemesons
@user475748: follow the instructions for the Paperclip gem. It handles the internal details of file uploads, letting you simply specify configuration values and letting it do the rest :)
Matchu