开发者

Paperclip validate .apk-file

开发者 https://www.devze.com 2023-02-26 07:35 出处:网络
I want to only be able to upload .apk files. However, when I try this with an .apk file it is rejected.

I want to only be able to upload .apk files. However, when I try this with an .apk file it is rejected.

What I have tried so far:

validates_atta开发者_如何学Gochment_content_type :app, :content_type => ['apk']

How do you do this? Perhaps there is a way to specify a regex for the file name (and extension) ?


Try

validates_attachment_content_type :app, :content_type => ['application/vnd.android.package-archive']

This is the actual mime type for apk files.

If that doesn't work, then remove the validation temporarily and upload an apk file. See what the content_type is being stored as in the database and then use that as the string. You may need to test with a variety of browsers in case there are differences.

Hope this helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消