module CarrierWaveBase64Uploader
Constants
- VERSION
Public Instance Methods
cache!(file = sanitized_file)
click to toggle source
Override file managing to manually decode the base64 string
Calls superclass method
# File lib/carrier_wave_base64_uploader.rb, line 6 def cache!(file = sanitized_file) if file.is_a?(String) && file.start_with?('data:image') filename = "#{SecureRandom.uuid}.photo" filedata = file local_file = CarrierWaveBase64Uploader::Base64StringIO .new(filedata, proc { filename }) super(local_file) else super(file) end end