mjgirl
mjgirl

Reputation: 41

File storage in Spring

I would like to save files uploaded from a form to certain folder in my Spring 3 application. I'm a rookie with this, don't know how to get started. Files must be java File format.

Upvotes: 3

Views: 6896

Answers (2)

Sean Patrick Floyd
Sean Patrick Floyd

Reputation: 298818

Here's how you can define the absolute path to a temporary directory using 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:

Upvotes: 5

skaffman
skaffman

Reputation: 403441

Use Spring's FileUpload support, it's fully documented, with examples.

Upvotes: 1

Related Questions