Skip to content Skip to sidebar Skip to footer

Django Image Uploading

I have a problem with image uploading. For now, chosen image file is not copied to destination directory and path to this file is not added to database. I'm giving my code below: m

Solution 1:

https://docs.djangoproject.com/en/dev/topics/http/file-uploads/

your form should have the enctype="multipart/form-data" or request.FILES won't have any data stream associated

Solution 2:

your ModelForm is bound to UserProfile model, but your are instantiating it with instance=user.

PS: request.user is User.objects.get(pk=request.user.id)

Post a Comment for "Django Image Uploading"