How to configure django-uploadify for videos upload only?

天大地大妈咪最大 提交于 2019-12-20 06:28:53

问题


I want to use django-uploadify to upload for videos only, I just want it to upload videos only, all kind of videos, or at least all kind of popular video formats.

So far, i added uploadify in settings.py and in urls.py I added this

(r'^uploadify/',include('uploadify.urls')),

But didn't go through every step described in the docs just yet, I'll do the other steps when you tell me how to configure django-uploadify for videos only.

django-uploadify is not well documented so i'm relying on your experience to configure it.

if you have a better way to create a video uploading form, please tell me.


回答1:


django-uploadify does not come with a custom filefield you are still going to use the django FileField that AFAIK does not have this kind of validation (filename extension checking).

You have to implement yourself this validation, you can do that using model validation or you can extend the django-uploadify form and add some validation there.

you can see a code example here




回答2:


You will have to modify the templatetag to include the fileExt option to enable client side file extension checking. This will only check if someone is "probably" uploading a video.

You should of course also implement server side model validation too, as you can't trust the client.



来源:https://stackoverflow.com/questions/9960099/how-to-configure-django-uploadify-for-videos-upload-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!