开发者

how can I restrict django ImageFieldFile to accept input only Image files from browser?

I've used d开发者_如何学Gojango ImageFieldFile, from django.db.models.fields.files import ImageFieldFile

now I want to restrict the user to use only Image files when uploading from browser


Try this http://www.djangosnippets.org/snippets/1303/

and (regarding your comment below) if you want client-side validation, take a look at this thread on the topic

NB: relying on client side validation only is not going to be safe enough. If you're concerned about people uploading other file types, you need to also validate on the server.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜