VCard Upload Import

I’m trying to add Vcard import functionality and I keep getting the
following using the code provided below. I’m using the VPIM library
to decode the vcards and add them to my database table. Can someone
help me out, or point me in a different direction for importing
VCards. Thanks.

Error:
cannot convert StringIO into String

Controller Code:
require ‘vpim/vcard’

if request.post? and params[:import_file]
cards = Vpim::Vcard.decode(File.open(params[:import_file]))
end

if request.post? and params[:import_file]
cards = Vpim::Vcard.decode(File.open(params[:import_file]))
end

Try File::read instead of File::open.

-Ben

I still get the same “cannot convert StringIO into String” error
message when I changed it to File.read

  • Kyle

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs