Upload file in Rails

I’m a newb, i’m want to upload file in my “File Folder”.Can you help me
this code about this.thanks

google search acts as attachment.

this is my view-

<%= start_form_tag( {:action => ‘create’}, {:multipart => “true”},
{:id=>“files”},{:enctype=>“multipart/form-data”} ) %>

<%= end_form_tag %>

and in my controller i have opened the file in write mode with same
file name from view and path i have specifed and whole file i have
written to this new file.

@file = params[:logo_file]

if @file.original_filename.length > 0
filename = “E:/” + @file.original_filename
File.open(filename, “wb”) { |f| f.write(@file.read) }
end

good luck.

it nice.thanks manohar amrutkar .

I would recommend the file_column plugin which is very stable,
configurable, and easy to use. Besides it offers an integration of
RMagic to handle images (scaling, etc.).

Star

watxit wrote:

it nice.thanks manohar amrutkar .

searching for “upload files ruby rails” in Google yields pretty
interesting results.

On 3/6/07, watxit [email protected] wrote:

I’m a newb, i’m want to upload file in my “File Folder”.Can you help me
this code about this.thanks


Ramon Miguel M. Tayag

On 06 Mar 2007, at 17:49, Star B. wrote:

I would recommend the file_column plugin which is very stable,
configurable, and easy to use. Besides it offers an integration of
RMagic to handle images (scaling, etc.).

I prefer acts_as_attachment or attachment_fu over filecolumn nowadays.

Best regards

Peter De Berdt