﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27334	File uploads could rename temporary files rather than copying them	Adam Chidlow	nobody	"Using default settings, when a file is uploaded and is greater than 2.5MB it will get saved as a temporary file. However even if that temporary file is on the same file system as MEDIA_ROOT, it will be copied instead of moved.

This appears to be because FileField.pre_save passes the FieldFile as 'content' to Storage.save(), instead of FieldFile.file, which is the TemporaryUploadedFile having a temporary_file_path attribute thus invoking file_move_safe.

This appears to have been the behaviour from the beginning: [https://github.com/django/django/blame/master/django/db/models/fields/files.py#L296]

For large uploaded files this has some undesirable consequences, it increases the time for the request to complete, and when running Django certain ways (at least under gunicorn using gthread workers), the temporary file won't be closed until that worker has recieved another request, so it's taking up double the storage for that time."	Cleanup/optimization	closed	File uploads/storage	1.10	Normal	fixed	FileField, TemporaryUploadedFile		Accepted	1	0	0	0	0	0
