Reputation: 11
I am using the paperclip 6.0.0 gem and I want to support uploading of documents using a data URI or base64 encoded string in rails application.
Referred : https://github.com/thoughtbot/paperclip/issues/2575
My app/intializers/paperclip.rb has the following:
Paperclip::DataUriAdapter.register
My model looks like this:
class Document < ApplicationRecord
has_attached_file :doc, :restricted_characters => nil
end
My parameter looks like this:
doc => { data:application/octet-stream;name=testing.json.jbuilder;base64,anNvbi50eXBlICdTaW5nbGVDb2x1bW4nDQpqc29uLnN0eWxl ..... }
I am getting the following error in console:
Paperclip::AdapterRegistry::NoHandlerError (No handler found for "data:application/octet-stream;name=testing.json.jbuilder;base64,anNvbi50eXBlICdTaW5nbGVDb2x1bW4nDQpqc29uLnN0eWxl ..... ")
Not sure if it has anything to do with newer version ...
Thanks.
Upvotes: 1
Views: 638
Reputation: 21
They do support it but you have to enable a configuration by adding Paperclip::DataUriAdapter.register
in config/initializers/paperclip.rb
.
See the issue here: https://github.com/thoughtbot/paperclip/issues/2575.
Upvotes: 2