On Mon, 2009-01-26 at 21:06 -0800, chatchai wrote: > Thanks for your quick reply, > > I need to unique file upload name because the client say the file is > unique by name (date based) so that they won't upload the same file. > > I know that the file name cannot determine file uniqueness. > > At this point, I need to return error if they try to upload the same > (name) file.
Okay, that shouldn't be too hard. Assuming you're accepting input through a form (using Django's form support, in django.forms), you can write a custom validation/cleaning function for the form field that checks if the name for the submitted file already exists. Using os.stat(), for example. If it does exist, you can raise a ValidationError with an appropriate error message. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---