Upload file to S3 using CarrierWave without a model, is it possible?

徘徊边缘 提交于 2019-11-30 07:08:31
Taavo

I think you want File.open instead of File.read. The latter returns a raw string, which CarrierWave doesn't know how to store.

uploader = CsvUploader.new
File.open(file_path) do |file|
  something = uploader.store!(file)
end
uploader.retrieve_from_store!(self.file_name)

This could probably be clearer in the docs, but I confirmed it by checking the specs. Bummer that CarrierWave is failing silently here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!