开发者

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

开发者 https://www.devze.com 2022-12-29 22:03 出处:网络
I\'ve used d开发者_如何学Gojango ImageFieldFile, from django.db.models.fields.files import ImageFieldFile

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

精彩评论

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