django forms without model
<p>I want to upload an image from a form without model.
I've tried to make:</p>

<p>In the template: det.html</p>

<pre><code>Upload image
    &lt;form enctype="multipart/form-data" action="" method="post"&gt;{% csrf_token %}
        &lt;input type="file" name="myfile" id="myfile" /&gt;
        &lt;input type="submit" value="Upload image"&gt;
    &lt;/form&gt;
</code></pre>

<p>In the views, I have:</p>

<pre><code>def fileupload(request):

    return responsewrapper('personne/det.html', locals(),request)

def handle_uploaded_file(f):
    filename = file._get_name()
    destination = open('/personne/static/personne/%s'%filename, 'wb+')
    for chunk in f.chunks():
        destination.write(chunk)
    destination.close()

def submitfilecontent(request):
    handle_uploaded_file(request.FILES['myfile'])
    return HttpResponseRedirect("/successupload")
</code></pre>

<p>The error is: Method Not Allowed (POST): /fr/detect/</p>

<p>my urls:</p>

<pre><code>urlpatterns += i18n_patterns(
    url(r'^admin/', admin.site.urls, name="admin"),
    url(r'^$', views.IndexView.as_view(), name="homepage"),
    url(r'^detect/$', views.DetectView.as_view(), name="detection"),
    url(r'^login/$', auth_views.login, name="login"),
    url(r'^logout/$', auth_views.logout, name="logout"),
    url(r'^register/',views.addUser, name='register'),

)+ i18n_patterns('', (r'^(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': MEDIA_ROOT, 'show_indexes': True}))
</code></pre>

<p>Update: </p>

<p>in urls.py, I added:</p>

<pre><code>  url(r'^submitfilecontent/$', submitfilecontent, name="submit-file-content"),
</code></pre>

<p>in the template:</p>

<pre><code>&lt;form enctype="multipart/form-data" action="/submitfilecontent/" method="post"&gt;
</code></pre>

<p>The new error: MultiValueDictKeyError: "'myfile'"</p>