Back Forum Reply New

CommonsMultipartResolver ignores setUploadTempDir

Any idea why CommonsMultipartResolver ignores setUploadTempDir?

CommonsMultipartResolver use the same tempdir whether setUploadTempDir is called or not.Code:
FileSystemResource fileSystemResource = new FileSystemResource(quot;c:/work/bougusTmpDir/quot;);
CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
commonsMultipartResolver.setUploadTempDir(fileSystemResource);According to the doc if tempUploadDir is not set it uses the directory returned from WebUtils.getTempDir() .

Do you have more information (stacktrace, etc) that leads you to believe that it is not using the tempUploadDir that you specify?

Debugging shows that the isUploadTempDirSpecified flag is set to true, and the uploadTempDir is set correctly for the commonsMultipartResolver object.
But visual inspection of the file system shows that the temp file is placed on the same directory as if the UploadTempDir was not specified.

We are running this inside Tomcat, could that be a matter?

How to you use this instance of MultipartResolver? If used within a DispatcherServlet: are you sure that your instance of MultipartResolver is actually used? Usually a MultipartResolver is declared as bean in the bean factory of the DispatcherServlet so it will be detected during bean factory instantiation.
¥
Back Forum Reply New