Hi All,

I've been playing with FileField and file uploading.

I do have a problem that I can't seem to solve;  when a file gets
uploaded, it is placed in the media directory under some random
filename the client was using.  I would like to normalize this filename
so that

foo.txt

is saved on the server as

MEDIA_ROOT/text/username_fileid.txt

I have tried combining _post_save() and os.rename(...) to some limited
success but am not able to reset my FileField to the new file path (my
assumption is that using save() inside _post_save() causes infinite
recursion, no?).  Clearly said strategy is an ugly hack with some major
problems.

Is there an elegant way to do this?

Regards,
Bo

Reply via email to