Hi, I'm having a little difficulty with validating a file which is uploaded by the user in the admin centre. Basically, I've created a small model which stores data about a music file upload. The documentation for FileField (which I'm using) says (I quote): 'Validate all uploaded files so that you're sure the files are what you think they are...'
However, I can't get this to work. I have created a custom validator, which checks whether the filetype is of mp3 or ogg, and that the extension is 'mp3' or 'ogg'. This works fine for the initial upload (and indeed I can upload files!), but when I go to the 'edit' part of the admin and upload a new file, I get a TypeError. This is because in my validator, I check the field_data the first time for 'filename' and 'content-type', because field_type is a dictionary, but it seems that on an edit, field_type is a string with the filename of the _previous_ file which was uploaded. Why?! Anyway, my question is: how can I complete this (seemingly) relatively simple task of validation? Here's my code so far: http://dpaste.com/5068/ Any help would be much appreciated. -- Isaac --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

