Hi,
I want to upload files to be processed without being saved in a model.
Sure, I can create an acts_as_attachment model for these and not save
the uploaded file, but is there any more direct solution?
Thanks,
Helzer
Hi,
I want to upload files to be processed without being saved in a model.
Sure, I can create an acts_as_attachment model for these and not save
the uploaded file, but is there any more direct solution?
Thanks,
Helzer
if you use a form like this:
<% form_tag(csv_upload_invitations_path(), { :multipart => true }) do %>
<%= file_field_tag “file” %>
<%= submit_tag(“upload”) %>
<% end %>
you’ll get the file content in params[:file]
which you should be able to process like:
CSV::Reader.parse(params[:file].read) do |parsed|
…
end
(i copy/pasted that with csv from a project, but should work with any
other file based operations just the same)
Hi Thorsten,
You’re probably a mind reader. I was just going to do use this for CVS
import myself.
Just saved me a lot of time on both the model and CSV processing.
Thanks a lot!
Amir
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs