summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2008-08-27 22:21:14 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2008-08-27 22:21:14 +0000
commitff420b43647dd7f149f000efd2c7eb077f6ba5cf (patch)
tree5e183421e0d4b78fa607f5b0fd664c3d3b2c7f29 /docs/topics
parentf58217cc02fe6779a69bdf092ce6095bb368401c (diff)
Fixed #8454: added a FILE_UPLOAD_PERMISSIONS setting to control the permissoin of files uploaded by the built-in file storage system. Thanks, dcwatson.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8640 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/http/file-uploads.txt44
1 files changed, 32 insertions, 12 deletions
diff --git a/docs/topics/http/file-uploads.txt b/docs/topics/http/file-uploads.txt
index 54edd9e72d..6f7c5fbe83 100644
--- a/docs/topics/http/file-uploads.txt
+++ b/docs/topics/http/file-uploads.txt
@@ -122,25 +122,43 @@ Changing upload handler behavior
Three settings control Django's file upload behavior:
- ``FILE_UPLOAD_MAX_MEMORY_SIZE``
- The maximum size, in bytes, for files that will be uploaded
- into memory. Files larger than ``FILE_UPLOAD_MAX_MEMORY_SIZE``
- will be streamed to disk.
+ :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`
+ The maximum size, in bytes, for files that will be uploaded into memory.
+ Files larger than :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE` will be
+ streamed to disk.
Defaults to 2.5 megabytes.
- ``FILE_UPLOAD_TEMP_DIR``
- The directory where uploaded files larger than ``FILE_UPLOAD_TEMP_DIR``
- will be stored.
+ :setting:`FILE_UPLOAD_TEMP_DIR`
+ The directory where uploaded files larger than
+ :setting:`FILE_UPLOAD_TEMP_DIR` will be stored.
Defaults to your system's standard temporary directory (i.e. ``/tmp`` on
most Unix-like systems).
+
+ :setting:`FILE_UPLOAD_PERMISSIONS`
+ The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
+ more information about what these modes mean, see the `documentation for
+ os.chmod`_
+
+ If this isn't given or is ``None``, you'll get operating-system
+ dependent behavior. On most platforms, temporary files will have a mode
+ of ``0600``, and files saved from memory will be saved using the
+ system's standard umask.
+
+ .. warning::
+
+ If you're not familiar with file modes, please note that the leading
+ ``0`` is very important: it indicates an octal number, which is the
+ way that modes must be specified. If you try to use ``644``, you'll
+ get totally incorrect behavior.
+
+ **Always prefix the mode with a ``0``.**
- ``FILE_UPLOAD_HANDLERS``
- The actual handlers for uploaded files. Changing this setting
- allows complete customization -- even replacement -- of
- Django's upload process. See `upload handlers`_, below,
- for details.
+ :setting:`FILE_UPLOAD_HANDLERS`
+ The actual handlers for uploaded files. Changing this setting allows
+ complete customization -- even replacement -- of Django's upload
+ process. See `upload handlers`_, below, for details.
Defaults to::
@@ -150,6 +168,8 @@ Three settings control Django's file upload behavior:
Which means "try to upload to memory first, then fall back to temporary
files."
+.. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
+
``UploadedFile`` objects
========================