From a6a0b29318e437de1f97329e6a5490d62fb36d3d Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Sun, 17 May 2009 18:45:25 +0000 Subject: [PATCH] Fixed #10400: Added a note in the file uploads doc about the correct form type needed for file uploads to work. Thanks claudep and timo. git-svn-id: http://code.djangoproject.com/svn/django/trunk@10816 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/topics/http/file-uploads.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/topics/http/file-uploads.txt b/docs/topics/http/file-uploads.txt index 931c1073e83..428b390a2f5 100644 --- a/docs/topics/http/file-uploads.txt +++ b/docs/topics/http/file-uploads.txt @@ -30,6 +30,10 @@ is a dictionary containing a key for each ``FileField`` (or ``ImageField``, or other ``FileField`` subclass) in the form. So the data from the above form would be accessible as ``request.FILES['file']``. +Note that ``request.FILES`` will only contain data if the request method was +``POST`` and the ``
`` that posted the request has the attribute +``enctype="multipart/form-data"``. Otherwise, ``request.FILES`` will be empty. + Most of the time, you'll simply pass the file data from ``request`` into the form as described in :ref:`binding-uploaded-files`. This would look something like::