Hi Friends,
when retrieving file that is uploaded , I'm getting multiValueDictKeyError.
Below are my codes. I have proided some codes where I m getting error.
could anyone help me here ?
views.py
-------------
def webform_submit(request):
if request.method =='POST':
name = request.POST['name']
email = request.POST['email']
phone = request.POST['phone']
job_title = request.POST['job_title']
resume = request.FILES['document'] -- getting
error here
user_info = UserField(name = name, email = email, phone = phone,
job_title = job_title, resume = resume)
user_info.save()
messages.success(request,"Congrats!! Form is successfully saved in
DB")
return render(request, 'html/form.html', {})
form.html
------------------
</div>
<label>Job title</label>
<input type="text" name="job_title" placeholder="Job Title" required>
<div class="form-group">
<label for="exampleFormControlFile1">Resume</label>
<input type="file" name="document" class="form-control-file"
id="exampleFormControlFile1">
</div>
<input type="submit" value="Submit">
</form>
thank you.
--
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 [email protected].
To post to this group, send email to [email protected].
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/37a3ca49-6410-420f-a6a6-23bcf8e3f983%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.