'WSGIRequest' object has no attribute 'Files'

2.521 kali dilihat
Langsung ke pesan pertama yang belum dibaca

Soumen Khatua

belum dibaca,
16 Apr 2019, 03.05.1516/04/19
kepadadjango...@googlegroups.com
Hi Folks,
I'm getting this error 'WSGIRequest' object has no attribute 'Files' and i didn't get proper solution in google also. I alredaty took enctype="multipart/form-data" in my forms tag. Here is my code snippet please provide me the solution it's urgent.

Thank you in advance.

.html

  <form class="" method="post"  enctype="multipart/form-data">
                {% csrf_token %}
                {{ p_form.as_p }}
                <input type="submit" name="" value="Change">
  </form>


models.py

class Profile(models.Model):
    user = models.OneToOneField(User, on_delete=models.CASCADE)
    bio =  models.TextField(blank=True, null=True)
    image = models.ImageField(default='profile/default.jpg', upload_to='profile')

views.py

def profile_view(request):
if request.method == 'POST':
print("this is update form post method")
p_form = ProfileUpdateForm(request.POST,request.Files,instance =                                                                                          request.user.profile)
if  p_form.is_valid():
                              p_form.save()
                              return redirect('profile')

Error:
'WSGIRequest' object has no attribute 'Files'



Jani Tiainen

belum dibaca,
16 Apr 2019, 03.53.1116/04/19
kepadadjango...@googlegroups.com
Hi.

It is .FILES all in capital. Not just first letter.


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPUw6WYQi_pc-GHt8-jsupbkuamL9RK7TZXV3J%3D%2B3yd%3DoWUtiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Soumen Khatua

belum dibaca,
16 Apr 2019, 14.01.5616/04/19
kepadadjango...@googlegroups.com

Sanket Chudasama

belum dibaca,
22 Mei 2023, 17.34.0122/05/23
kepadaDjango users
p_form  = ProfileUpdateForm(data= request.POST, files= request.Files, instance = request.user)

Ryan Nowakowski

belum dibaca,
27 Mei 2023, 16.51.5627/05/23
kepadaSanket Chudasama, Django users
I believe it should be all lower case request.files

Bhuvnesh Sharma

belum dibaca,
28 Mei 2023, 01.28.2828/05/23
kepadadjango...@googlegroups.com

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Joel Tanko

belum dibaca,
28 Mei 2023, 11.23.0328/05/23
kepadadjango...@googlegroups.com
Your python script should use
Request.FILES to get the MemoryUploadedFiles from your form. 

Balas ke semua
Balas ke penulis
Teruskan
0 pesan baru