开发者

Paperclip validate .apk-file

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜