When someone clicks Submit after selecting a file with the <input type="file">
element, how do I access the contents of the file in Django?
(It seems like the request sent to the request handler has no trace of the file anywhere -- not even in request.FILES
.)
Currently my template is like:
<form method="post" enctype="multipart/form-data">
<input type="file" enctype="multipart/form-data" name="file" accept="text/csv"/>
<input type="submit" value="Upload" />
</form>
View:
def HandleRequest(request):
print "**** request:", request
I don't see anything being printed about the file.
Note:
There's probably other ways to do this in Django, but I'm looking a solution using the simple input
tag, and not something else (which would probably involve Javascript).