问题描述
这是类似的情况,但没有解决方法 CarrierWave extension_white_list没有似乎有效Carrierwave提供了 extension_white_list
函数,该函数应防止用户上传无效文件.我没有对此功能发表评论,但是如何处理这种情况?我想捕获此错误,并通知用户他应该更改文件.
here is a similar case but no solution CarrierWave extension_white_list doesn't seem to workCarrierwave provides a function extension_white_list
which is supposed to prevent a user from uploading an invalid file. I have uncommented this function but how do I handle this case? I want to catch this error and inform the user that he should change the file.
此Wiki条目似乎相关,但我不确定如何进行 https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Validate-uploads-with-Active-Record
this wiki entry seems relevant but I'm not sure how to proceed https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Validate-uploads-with-Active-Record
推荐答案
根据此问题 https://github.com/carrierwaveuploader/carrierwave/issues/1896
解决方案是这样,它对我有用;
The solution is this and it worked for me;
更改:
def extension_white_list
end
收件人:
def extension_whitelist
end
因此他们从白名单单词中删除了下划线.
so they have removed the underscore from whitelist word.
这篇关于carrierwave extension_white_list无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!