<commit_before>.. _topics-file-uploads:

============
File Uploads
============

.. currentmodule:: django.core.files

.. versionadded:: 1.0

Most Web sites wouldn't be complete without a way to upload files. When Django
handles a file upload, the file data ends up placed in ``request.FILES`` (for
more on the ``request`` object see the documentation for :ref:`request and
response objects <ref-request-response>`). This document explains how files are
stored on disk and in memory, and how to customize the default behavior.

Basic file uploads
==================

Consider a simple form containing a ``FileField``::

    from django import forms

    class UploadFileForm(forms.Form):
        title = forms.CharField(max_length=50)
        file  = forms.FileField()

A view handling this form will receive the file data in ``request.FILES``, which<commit_msg>Removed 'Most Web sites wouldn't be complete without a way to upload files' sentence from file-uploads.txt in docs. I beg to differ.<commit_after>.. _topics-file-uploads:

============
File Uploads
============

.. currentmodule:: django.core.files

.. versionadded:: 1.0

When Django handles a file upload, the file data ends up placed in
``request.FILES`` (for more on the ``request`` object see the documentation for
:ref:`request and response objects <ref-request-response>`). This document
explains how files are stored on disk and in memory, and how to customize the
default behavior.

Basic file uploads
==================

Consider a simple form containing a ``FileField``::

    from django import forms

    class UploadFileForm(forms.Form):
        title = forms.CharField(max_length=50)
        file  = forms.FileField()

A view handling this form will receive the file data in ``request.FILES``, which
{'fraction_non_alphanumeric': 0.12781531531531531, 'fraction_numerical': 0.0045045045045045045, 'mean_word_length': 4.27299703264095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1862552', 'n_tokens_mistral': 486, 'n_tokens_neox': 457, 'n_words': 210}