I would like some help in figuring out how to handle file validation in my application. I have a series of processing that I'd like to happen at various stages. Some of this validation might have to happen outside of Django itself, like using JavaScript in the actual form as the files that are to be uploaded can be quite large in size.
For starters, I would like the extension of the selected file to be checked prior to submission. I have no experience with JavaScript but I take it that I can perform some sort of regex search there? I take it that this has been done before. Could some one point me in the direction of a clear and somewhat simple method of doing this with either a simple self-made script or one built-in to a library? If the filename passes validation, I want the form to be submitted BUT it would be great if there was some way to check the first few bytes of the file as it is being uploaded on the server-side. I should know that the first few bytes of a correct file look like and can do a regex search against a known list of strings. How does one check a file while it's being uploaded in Django? Also, how does one trigger and error or warning so that the upload stops and displays an error page to the user? I'm still pretty new to a lot of what Django provides as well as Python in general so please pardon me if this are well-documented and/ or know procedures. Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.