[英]Rails s3_direct_upload how to disable it
In Rails, I am using s3_direct_upload
gem for asset(doc file) upload. 在Rails中,我正在使用
s3_direct_upload
gem进行资产(文档文件)上传。 Right now if I try to upload an image file as a different asset, it is directly uploading to s3. 现在,如果我尝试将图像文件上传为其他资产,则该文件将直接上传到s3。 I need to disable this option for image upload and it should be enable only for document upload.
我需要为图像上传禁用此选项,并且应该仅对文档上传启用此选项。
s3_direct_upload
is provides form helper methods to upload images to s3 directly. s3_direct_upload
提供了表单帮助器方法,可将图像直接上传到s3。 like this s3_uploader_form
. 像这样
s3_uploader_form
。 It just reduces your jquery_file_upload and s3 configuration. 它只是减少了jquery_file_upload和s3配置。
But you can still upload image to your local file system. 但是您仍然可以将图像上传到本地文件系统。 Using simple
form_tag
. 使用简单的
form_tag
。 ie When you want to upload images to s3 use s3_uploader_form
syntax and when you want to upload images to local file system then use simple form_tag
or any other rails provided form syntax. 例如,当您要将图像上传到s3时,请使用
s3_uploader_form
语法;当您要将图像上传到本地文件系统时,请使用简单的form_tag
或任何其他rails提供的表单语法。
For uploading images using ajax use remotipart
gem with simple form syntax. 要使用ajax上传图像,请使用具有简单形式语法的
remotipart
gem。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.