0

When using CommonsMultipartResolver for file uploads where does spring stores larger files while processing them ?

We have a js check for the size and we put a maxUploadSize. If a user bypasses the js control and sends a huge file, what does spring do to process it ?

Thanks in advance

1 Answers1

0

CommonsMultipartResolver will save to the Servlet container's temporary directory.

You can limit the size of uploads by setting maxUploadSize property (default is 10240 bytes).

for example:

<bean id="multipartResolver" class="o.s.w.m.commons.CommonsMultipartResolver">
  ...
  <property name="maxUploadSize" value="###"/>
</bean>
ikumen
  • 11,275
  • 4
  • 41
  • 41
  • I assume its 'java.io.tmpdir'. The documentation of CommonsFileUploadSupport, implies that there is a property 'uploadTempDir' that can be set to change this default behavior. But what about the cleanup of these files ? Does spring handles this on his own ? – user3633167 May 15 '14 at 08:16
  • No, you need to manage the removal of files (e.g. daily/weekly cron job to remove old/processed files). – ikumen May 15 '14 at 08:41