plinth: Improve handling file uploads in apps
Currently, file uploads can fail because /tmp size is too small for large files. Commonly, /tmp is a tmpfs filesystem 10% of the size of total RAM. Uploaded kiwix or backup files can be more than 1 GB in size. File uploading is also used in featherwiki and tiddlywiki apps. To improve the situation, perhaps it makes sense to set FILE_UPLOAD_TEMP_DIR = '/var/tmp'
(https://docs.djangoproject.com/en/5.1/ref/settings/#file-upload-temp-dir). This folder is commonly a disk storage and is more suitable for large files.
Another issue is that upload views in plinth create secondary temporary files, which doubles the disk size needed. It seems unnecessary.
It may be beneficial to remove MemoryFileUploadHandler from django upload handlers (it is used when a file size is less than 2.5 MB), currently:
FILE_UPLOAD_HANDLERS = [
"django.core.files.uploadhandler.MemoryFileUploadHandler",
"django.core.files.uploadhandler.TemporaryFileUploadHandler",
]
If removed, then the path of the uploaded file is always available from TemporaryUploadedFile.temporary_file_path() (https://docs.djangoproject.com/en/4.2/ref/files/uploads/#django.core.files.uploadedfile.TemporaryUploadedFile.temporary_file_path).