Better to set the upload filesize limit on your server eg Apache's has a directive for max file size. Otherwise the file will be uploaded and checked anyway.
If you want to report an error to the user you could use validation on the form. The code below returns a error if a file extension is not allowed. from django import forms from os.path import splitext from django.utils.translation import gettext as _ class VideoField(forms.FileField): default_error_messages = {'invalid_video': _(u"Please upload a .wmv , .mov, .mp4 or .3pg"),} def clean(self, data, initial=None): f = super(VideoField, self).clean(data, initial) if f is None: return None elif not data and initial: return initial file_exts = ('.mp4', '.mov', '.wmv', '.3gp',) if not splitext(f.name)[1].lower() in file_exts: raise forms.ValidationError(self.error_messages['invalid_video']) return f --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---