File Storage in Spring

I would like to save the files downloaded from the form to a specific folder in my Spring 3 application. I am new to this, don't know where to start. Files must be in java format.

+3
source share
2 answers

Here you can define the absolute path to the temporary directory using the System Properties and Spring Expression Language :

<!-- package shortened for readability -->
<bean id="multipartResolver"
      class="org.springframework....CommonsMultipartResolver">
    <property name="uploadTempDir"
      value="#{ systemProperties['java.io.tmpdir'] }/yourwebapp/upload"/>
</bean>

Reference:

+5
source

Use Spring FileUpload support, it is fully documented , with examples.

+1

Source: https://habr.com/ru/post/1777879/


All Articles