summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/core/files/uploadedfile.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/core/files/uploadedfile.py b/django/core/files/uploadedfile.py
index 60c354a9f7..3ba7f995c6 100644
--- a/django/core/files/uploadedfile.py
+++ b/django/core/files/uploadedfile.py
@@ -58,7 +58,8 @@ class TemporaryUploadedFile(UploadedFile):
A file uploaded to a temporary location (i.e. stream-to-disk).
"""
def __init__(self, name, content_type, size, charset, content_type_extra=None):
- file = tempfile.NamedTemporaryFile(suffix='.upload', dir=settings.FILE_UPLOAD_TEMP_DIR)
+ _, ext = os.path.splitext(name)
+ file = tempfile.NamedTemporaryFile(suffix='.upload' + ext, dir=settings.FILE_UPLOAD_TEMP_DIR)
super().__init__(file, name, content_type, size, charset, content_type_extra)
def temporary_file_path(self):