0

From the JavaDocs:

The @MultipartConfig annotation supports the following optional attributes:

location: An absolute path to a directory on the file system. The location attribute does not support a path relative to the application context. This location is used to store files temporarily while the parts are processed or when the size of the file exceeds the specified fileSizeThreshold setting. The default location is "".

However, when

location="\Temp"

the file being uploaded is placed under:

\Servers\IBM\wlp\usr\servers\app\workarea\org.eclipse.osgi\113\data\temp\default_node\SMF_WebContainer\app-ear\app-1.0-SNAPSHOT\Temp\upload__4529d7ce_15f90e11b66__7ff3_00000002.tmp

which is not the absolute path given in the configuration.

How can we specify the correct folder?

UPDATE:

See Paul's answer below. Specifying 'C:/Temp' as location did the trick.

Marc
  • 13
  • 5

1 Answers1

0

The Servlet 3.0 specification is pretty vague in the description of the @MultipartConfig. However the latest versions of the Servlet specification state the following:

The location attribute of the javax.servlet.annotation.MultipartConfig and the element of the is interpreted as an absolute path and defaults to the value of the javax.servlet.context.tempdir. If a relative path is specified, it will be relative to the tempdir location. The test for absolute path vs relative path MUST be done via java.io.File.isAbsolute.

The reason why the platform in this case Windows matters is because java.io.File.isAbsolute() behavior depends on the OS being used:

So it would seem isAbsolute() is returning false in your case, if you follow the guidelines in the File JavaDoc you should be able get the files where you want them.