[英]Process file from <select> field in activeadmin form
I have a select that goes like this on one of my activeadmin forms: 在我的一个activeadmin表单中,我有一个这样的选择:
f.input :sdfile, :as => :select, :collection => Dir.glob("incoming/*")
The user is supposed to upload the file to a "incoming" dir beforehand. 用户应该事先将文件上传到“传入”目录。
I now want to process this file, moving it to the proper folder, but CarrierWave refuses to "upload" from a pathname. 现在,我想处理此文件,将其移动到正确的文件夹中,但是CarrierWave拒绝从路径名“上传”。
Any easy way to process the file, moving it to the respective folder? 有任何简单的方法来处理文件,将其移动到相应的文件夹吗?
Thanks. 谢谢。
Try it like this: 像这样尝试:
Image.new :data=>File.new("/path/to/image.jpg","r")
or 要么
Image.new :data=>File.open('/path/to/image.jpg', 'rb')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.