In form use this field:

class MyImageField(ImageField):

    def __init__(self, *args, **kwargs):
        super(MyImageField, self).__init__(*args, **kwargs)

    def clean(self, *args, **kwargs):
        data = super(MyImageField, self).clean(*args, **kwargs)
        try:
            data.name = slugify_name(data.name)
            filename = data.name
            ext = os.path.splitext(filename)[1]
            ext = ext.lower()
        except AttributeError:
            pass
        return data

Just write the function slugify_name which will replace all non-ascii
characters.

R.

On 4. Máj, 15:19 h., Ariel <isaacr...@gmail.com> wrote:
> And how can I change the filename of the image when it is uploaded ???
>
> 2011/5/4 urukay <radovan.be...@gmail.com>
>
> > Or try to change the name of the file when uploading the image/file.
> > That's how solved it. Had couple problems with it also in development
> > enviroment and now it's working ok. Haven't tested yet in production,
> > but it should work too.
>
> > Radovan
>
> > On 3. Máj, 22:56 h., Tomasz Zieliński
> > <tomasz.zielin...@pyconsultant.eu> wrote:
> > > W dniu wtorek, 3 maja 2011, 21:34:28 UTC+2 użytkownik Ariel napisał:
>
> > > > Yes, only on the production enviroment.
>
> > > Try to create a file with UTF8 characters in its name, from your code.
> > > Then you'll know if those Apache settings are in effect.
>
> > > --
> > > Tomasz Zielinski
> > > pyconsultant.eu
>
> > --
> > 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.
>
>

-- 
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.

Reply via email to