If you store the whole content of a file into a byte array the whole content is held in the RAM.
If the byte array is stored to the Dialog data the data is held until the dialog is closed with the Exit End or the session is destroyed. Normally the session gets only destroyed if the session timeout expires.
So that means it is normally not a good idea to store file contents on byte arrays (in RAM). This well will lead later or sooner to memory problems.
You should store the file again as file on the server. As example:
FileUploadEvent fileUploadEvent = ... // get it from param
String fileName = fileUploadEvent.getFile().getFileName();
InputStream inputStream = fileUploadEvent.getFile().getInputstream();
// This creates a temporary session file which will be removed if the session terminates
File ivyfile = new ch.ivyteam.ivy.scripting.objects.File(fileName, true);
FileOutputStream fileOutputStream = new FileOutputStream(ivyfile.getJavaFile());
IOUtils.copy(inputStream, fileOutputStream);
IOUtils.copy(inputStream, fileOutputStream);