I can't seem to upload a file to a Django form. The form POST is never valid.
Here is my code...
def upload_file(request):
if request.method == 'POST':
form = tummytutoring.forms.UploadFileForm(request.POST, request.FILES)
if form.is_valid():
open("FTM_file.exe", "w").write(request.FILES['file'])
return django.shortcuts.redirect("/thank_you")
else:
form = tummytutoring.forms.UploadFileForm()
return django.shortcuts.render(request, 'upload.html', {'form': form})
Here is the template....