I’m creating CSV-upload functionality for a site of mine.
I’m looking to upload a file, parse it, and then dispose of it.
I know I can upload and save a file using Paperclip, but that seems a bit like overkill.
All I need to do is parse the uploaded file and never save it.
How would I go about doing this in Rails 3?
Note: I’d prefer to do the uploading manually without using an external gem so I can learn how to process works, but any suggestions are welcome.
Thanks!
Use the
file_fieldhelper in your form, then in your controller you can useFile.WriteandFile.readto save the file.E.g. View
Controller
Edit: Just saw @klochner’s comment, that link says pretty much what I have said so follow that: RubyOnRails Guides: Uploading Files.