www.dextsolution.com
DEXTUPLOAD
JK
menu toggleReference > dextuploadjk > support > spring > JKMultipartResolver

dextuploadjk.support.spring
Class JKMultipartResolver

Minimum version
1.0.0
Minimum environment
Java 17, Spring Framework 6.0.14, Spring Boot 3.0.12
Description

This class handles multipart requests so that file uploads can be performed from clients.

The JKMultipartResolver class is an implementation of the org.springframework.web.multipart.MultipartResolver, org.springframework.web.context.ServletContextAware interface and is used in place of the org.springframework.web.multipart.commons.CommonsMultipartResolver or org.springframework.web.multipart.support.StandardServletMultipartResolver.

In your servlet XML file, set it up like this

<bean id="environment" class="dextuploadjk.engine.Environment">
    <property name="tempRepository" value="Temporary file storage directory path"/>
    <property name="defaultRepository" value="Path to the default file storage directory"/>
    <property name="maxFileSize" value="Maximum size limit for individual files"/>
    <property name="maxTotalSize" value="Maximum total file size"/>
    <property name="autoMakingDirectory" value="Whether to automatically create directories"/>
    <property name="whiteExtensions" value="List of allowed file extensions"/>
    <property name="filterAction" value="How to handle filters"/>
    <property name="compact" value="Whether to pass meaningless files"/>
    <property name="charEncoding" value="UTF-8"/>
    <property name="fileCopyOption" value="FileCopyOption enumeration value"/>
    <property name="fileCopyBufferSize" value="Copy buffer size"/>
    <property name="maxFileSize" value="Individual file limit size"/>
    <property name="maxTotalSize" value="total file size limit"/>
    <property name="loosely" value="Multipart analysis level"/>
    <property name="licenseFilePath" value="License file path"/>
    <property name="licenseConfigXmlPath" value="License management XML file path"/>
    <property name="licenseAuthKey" value="cfHzOu ... AuthKey ... rPTl1P"/>
</bean>

<bean id="idName" class="dextuploadjk.support.spring.JKMultipartResolver">
  <property name="environment" ref="environment"/>
</bean>

JKMultipartResolver is responsible for analyzing multipart data and creating temporary files in the location pointed to by the tempRepository property. Moving or copying these temporary files to the actual storage location is service-specific, so you'll need to write your own code to handle that in a method mapped to your controller.