summaryrefslogtreecommitdiff
path: root/docs
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
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')
-rw-r--r--docs/ref/settings.txt34
-rw-r--r--docs/topics/http/file-uploads.txt44
2 files changed, 66 insertions, 12 deletions
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index e4e32742ea..6273a3676f 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -453,6 +453,8 @@ Default: ``'utf-8'``
The character encoding used to decode any files read from disk. This includes
template files and initial SQL data files.
+.. setting:: FILE_UPLOAD_HANDLERS
+
FILE_UPLOAD_HANDLERS
--------------------
@@ -465,6 +467,8 @@ Default::
A tuple of handlers to use for uploading. See :ref:`topics-files` for details.
+.. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
+
FILE_UPLOAD_MAX_MEMORY_SIZE
---------------------------
@@ -475,6 +479,8 @@ Default: ``2621440`` (i.e. 2.5 MB).
The maximum size (in bytes) that an upload will be before it gets streamed to
the file system. See :ref:`topics-files` for details.
+.. setting:: FILE_UPLOAD_TEMP_DIR
+
FILE_UPLOAD_TEMP_DIR
--------------------
@@ -488,6 +494,34 @@ example, this will default to '/tmp' on \*nix-style operating systems.
See :ref:`topics-files` for details.
+.. setting:: FILE_UPLOAD_PERMISSIONS
+
+FILE_UPLOAD_PERMISSIONS
+-----------------------
+
+Default: ``None``
+
+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::
+
+ **Always prefix the mode with a 0.**
+
+ 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.
+
+
+.. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
+
.. setting:: FIXTURE_DIRS
FIXTURE_DIRS
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
========================