Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:12:09+00:00 2026-06-03T07:12:09+00:00

I have been trying to implement a image upload for changing avatar for individual

  • 0

I have been trying to implement a image upload for changing avatar for individual users. The problem I have right now is that it never uploads to the folder. It works from the admin but it doesn’t work on the template I’ve created

views.py

if 'avatar_upload' in request.POST:
    avatar_form = UserAvatarForm(request.POST, request.FILES, instance=request.user.get_profile())
    if avatar_form.is_valid():
        avatar_form.save()
        return HttpResponse(request.POST['avatar'])
    return HttpResponse("Failed")

I’ve changed the code for viewing the outputs. I get the file name in the POST. But I don’t have anything in the request.FILES. So I’m guessing it is a problem there, and I haven’t found out so far what the problem could be. Or could it be some problem elsewhere?

template*

<form action="" method="post" enctype="multipart/form-data">
    {% csrf_token %}
    {% for item in avatar_form %}<p>{{ item.label }}: {{ item }}</p>
    {% endfor %}
    <input type="submit" value="Upload avatar" name="avatar_upload">
</form> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:12:10+00:00Added an answer on June 3, 2026 at 7:12 am

    Have you set enctype="multipart/form-data" in form in the template?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a few weeks now, I have been trying to implement a DFT that
I have been trying to implement this code , where i capture a image
I have been trying to implement an efficient string comparing algorithm that will given
I've been stuck for ages now trying to implement threading or background image loading
Hello guys, I have been trying to implement the DSUM function but failed to
Im trying to implement an Observer/Observable pattern on an EC2 instance. I have been
I am trying to implement a RESTful API in which I have to upload
I have been trying to implement a CheckBox Node Tree, where the parent nodes
I have been trying to implement hash-tables using uthash.h, following the (excellent) documentation I
Im trying to implement an activity that uses ExpandableListView and I have gotten so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.