Make sure to make the directories before uploading, too.

git-svn-id: http://django-avatar.googlecode.com/svn/trunk@10 c76b2324-5f53-0410-85ac-b1078a54aeeb
This commit is contained in:
Eric Florenzano 2008-08-02 11:44:59 +00:00
parent b329ef276f
commit 5b3da03bce

View file

@ -95,6 +95,7 @@ def img(request, email_hash, resize_method=Image.ANTIALIAS):
def change(request, extra_context={}, next_override=None):
if request.method == "POST":
dirname = os.path.join(settings.MEDIA_ROOT, 'avatars')
os.makedirs(dirname)
filename = "%s.jpg" % request.user.avatar.email_hash
full_filename = os.path.join(dirname, filename)
(destination, destination_path) = tempfile.mkstemp()