Skip to content

Commit 2db181e

Browse files
Closes #11592: Expose FILE_UPLOAD_MAX_MEMORY_SIZE as a setting (#11742)
* Closes #11592: Expose FILE_UPLOAD_MAX_MEMOMORY_SIZE as a setting * change configuration settings to alphabetic order * Small example and documentation --------- Co-authored-by: aron bergur jóhannsson <[email protected]>
1 parent eee1a0e commit 2db181e

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

docs/configuration/miscellaneous.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ By default, NetBox will permit users to create duplicate prefixes and IP address
6969

7070
---
7171

72+
## FILE_UPLOAD_MAX_MEMORY_SIZE
73+
74+
Default: 2621440 (i.e. 2.5 MB).
75+
76+
The maximum size (in bytes) that an upload will be before it gets streamed to the file system. Changing this setting can be useful for example to be able to upload files bigger than 2.5MB to custom scripts for processing.
77+
78+
---
79+
7280
## GRAPHQL_ENABLED
7381

7482
!!! tip "Dynamic Configuration Parameter"

netbox/netbox/configuration_example.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,10 @@
217217
# this setting is derived from the installed location.
218218
# SCRIPTS_ROOT = '/opt/netbox/netbox/scripts'
219219

220+
# The maximum size (in bytes) that an upload will be before it gets streamed to the file system.
221+
# Useful to be able to upload files bigger than 2.5Mbyte to custom scripts for processing.
222+
# FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
223+
220224
# The name to use for the csrf token cookie.
221225
CSRF_COOKIE_NAME = 'csrftoken'
222226

netbox/netbox/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
EMAIL = getattr(configuration, 'EMAIL', {})
9292
EXEMPT_VIEW_PERMISSIONS = getattr(configuration, 'EXEMPT_VIEW_PERMISSIONS', [])
9393
FIELD_CHOICES = getattr(configuration, 'FIELD_CHOICES', {})
94+
FILE_UPLOAD_MAX_MEMORY_SIZE = getattr(configuration, 'FILE_UPLOAD_MAX_MEMORY_SIZE', 2621440)
9495
HTTP_PROXIES = getattr(configuration, 'HTTP_PROXIES', None)
9596
INTERNAL_IPS = getattr(configuration, 'INTERNAL_IPS', ('127.0.0.1', '::1'))
9697
JINJA2_FILTERS = getattr(configuration, 'JINJA2_FILTERS', {})

0 commit comments

Comments
 (0)