Detail
#24715
Dealing with large file sizes during uploads through file drops
Currently the FileDropHandler and also the GalleryControl does not check the amount or size of files to be uploaded. This may lead to an overhead and the upload cannot be done correctly. Therefore it should be possible to limit the maximum upload size.
Improvement
Both in the WebFolderComponent and in the WebFolderUIFactory it is now possible to configure the max-upload-size. The size is specified as MemorySizeFormat. If the WebFolderComponent does not have a corresponding configuration, it uses the one of the WebFolderUIFactory, which is set to unlimited by default. \\ 0 must be entered for unlimited upload. The GalleryControl already has a configuration for maximum uploads(MAX_DATABASE_SIZE_MEGABYTE in the ImageSizeConfig) and now uses this for file drop uploads as well. \\ Additionally it is already checked on the client side if the maximum size was exceeded. In case of an error, this is sent back to the server as a message with the maximum upload size, so that the server can generate an appropriate error message.
Application
The WebFolderUIFactory and the WebFolderComponent are configured as follows: {{#!xml <config service-class="com.top_logic.common.webfolder.ui.WebFolderUIFactory">
<instance max-upload-size="0" />
</config> }}
{{#!xml <config config:interface="com.top_logic.common.webfolder.ui.WebFolderComponent$Config
"max-upload-size="1024"
/> }}}
Test
Under Structures > A > Type demo in the WebFolder start an upload via drag and drop. If the upload size exceeds 5 MB, an error message must appear and nothing may be uploaded. The same applies to the WebFolder under Structures > A > Documents and GalleryControl.
Code Migration
- FileDropHandler implements now additionally the function getMaxUploadSize
- The constructor of the FolderFileDropHandler now gets an additional maxSize for the maximum size of data that can be uploaded:
FolderFileDropHandler(boolean manualLocking, boolean uploadPossible, long maxSize)