I must have missed something with the new Flow Java Upload component. I simply cannot seem to get a file saved to the server-side. I tried instantiating the Upload component with a FileBuffer, and when the upload play button is clicked the file information (name, size, mime-type) is all available, but the input stream is unaccessible. I get the following exception:
java.io.IOException: Access is denied
Here’s what I am trying in the SucceededListener:
byte[] os = new byte[(int)event.getContentLength()]
;
buffer.getInputStream().read(os);
That is where the exception gets tossed.
Any suggestions would be greatly appreciated. And I can add more of the code if needed. Am I in the proper listener? I just had that thought, should I be using the FinishedListener instead, would that even make a difference?
from the error you get I would expect that the file the FileBuffer created cannot be read. But I do not know why. Have you specified any special file factory? By default FileBuffer uses File.createTempFile().
You can also try MemoryBuffer to limit the possible error causes.
I tried the MultiFileMemoryBuffer, and that worked to save the file off to a specified directory. Here is the snippet of the Upload addSucceededListener event. Thanks for your suggestion about trying the memory buffer.