Charanya Nagarajan wrote:
> Hi
>
> I wish to upload a file not from the view but from the controller
> itself.
> I have the file's path and mimetype and size.
> I would like to know How it can be done directly from the controller
>
> Thanks in Advance
filepath = File.open("File_path","r")
File.open(path_where_u_want_to_upload, "wb") { |f|
f.write(filepath.read) }
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---