I am desperately trying to make a very simple file upload using Django, without (at the moment) worrying about templates and co.
My HTML:
<form
id="uploader"
action="bytes/"
enctype="multipart/form-data"
method="post"
>
<input type="file" name="uploaded"/>
<input type="submit" value="upload"/>
</form>
My Python (knowing that this is POST):
if path=="bytes/":
if 'uploaded' in request.FILES:
return HttpResponse("you uploaded a file")
else:
return HttpResponse("did not get the file")
I don’t understand why I always get the message “did not receive the file” ...
Can someone help me please ???
Julien Boyreau
source
share