I have the following java code in Spring framework to convert a multipart file to a regular file:
public static File convertToFile(MultipartFile multipart) {
So the code looks like this: StandardMultipartHttpServletRequest
public void transferTo(File dest) throws IOException, IllegalStateException {
this.part.write(dest.getPath());
}
and MultiPartInputStreamParser:
/**
* @see javax.servlet.http.Part#write(java.lang.String)
*/
public void write(String fileName) throws IOException
{
if (_file == null)
{
_temporary = false;
//part data is only in the ByteArrayOutputStream and never been written to disk
_file = new File (_tmpDir, fileName);
So in the case that the file isn't on disk, we will end up with /tmp
twice.
I think this is a bug in StandardMultipartHttpServletRequest
-- it is passing a path to something which expects a filename.