My app is a surveybuilder…it needs upload cvs files by users, Im working with rails 3.1.3., ruby 1.9.2 ande devise 1.5.3 for authentication, but I tried: http://www.jedi.be/blog/2009/04/10/rails-and-large-large-file-uploads-looking-at-the-alternatives/ but don’t works for me…can anybody tell me how to (step by step…yes I’m a begginer) upload cvs files in rails 3.1.3??? thanks in advance.
Share
If your goal is to upload a file to a directory you shouldn’t have to use Carrierwave or Paperclip. Those gems have a lot of support for image processing and extra options.
I suggest you look at the Ruby file class and the open method to be more specific. http://www.ruby-doc.org/core-1.9.3/File.html#method-c-open
Something like the following should do the trick:
Keep in mind, your public directory is accessible to the world. If you need to save these in a more private location, make sure the directory is only readable and writable by your app.
Also, if you are working with CSV files, be sure to read through the Ruby CSV class: http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html. It makes working with CSV files a breeze.