Question about Upload and memory / temp file

Hi,
I am using the upload module and tried to use MultiFileBuffer as well as MultiFileMemoryBuffer.
But I am facing a problem where, without creating an own Receiver, I do not see a solution.

MultiFileBuffer:
Created a tmp file with File.createTempFile(String, String)
But how do I get access to this tmp file to delete it?
I can get the inputstream for the file, but I do not get access to the file to clean and delete it after I am finished.

MultiFileMemoryBuffer:
Does store the bytes in memory.
I can get the inputstream, write it into a file and close the stream.
But how do I get the memory cleared?

In the tutorial: https://vaadin.com/docs/flow/components/tutorial-flow-upload.html there is no description about how to clear the memory or delete the tmp file.
Is the only way to achive it, creating my own Receiver?

Thats my code:
upload.addFinishedListener(e → {

		try {
			FileUtils.copyInputStreamToFile(buffer.getInputStream(e.getFileName()),
					new File(myPath + e.getFileName()));

		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
	});

Thank you for your help in advanced.

Yes, I think you’ll need a custom Receiver. I’d recommend creating a ticket about the issue to https://github.com/vaadin/vaadin-upload

li n83:
Hi,
I am using the upload module and tried to use MultiFileBuffer as well as MultiFileMemoryBuffer.
But I am facing a problem where, without creating an own Receiver, I do not see a solution.

MultiFileBuffer:
Created a tmp file with File.createTempFile(String, String)
But how do I get access to this tmp file to delete it?
I can get the inputstream for the file, but I do not get access to the file to clean and delete it after I am finished.

MultiFileMemoryBuffer:
Does store the bytes in memory.
I can get the inputstream, write it into a file and close the stream.
But how do I get the memory cleared?

In the tutorial: https://vaadin.com/docs/flow/components/tutorial-flow-upload.html there is no description about how to clear the memory or delete the tmp file.
Is the only way to achive it, creating my own Receiver?

Thats my code:
upload.addFinishedListener(e → {

  	try {
  		FileUtils.copyInputStreamToFile(buffer.getInputStream(e.getFileName()),
  				new File(myPath + e.getFileName()));

  	} catch (IOException e1) {
  		// TODO Auto-generated catch block
  		e1.printStackTrace();
  	}
  	
  });

Thank you for your help in advanced.

For what it’s worth, I always save directly to file system to avoid the risk if having numerous large file tranfers in memory.