All works fine, i do correctly upload on my remote folder but I can't understand how this component render progress bar.
This is my handler
Code: Select all
public void handleFileUpload(FileUploadEvent event) {
try {
String nameFile = event.getFile().getFileName();
//String fileType = event.getFile().getContentType();
File result = new File(getSessionBean().getPath + nameFile);
FileOutputStream out = new FileOutputStream(result);
int BUFFER_SIZE = 8192;
byte[] buffer = new byte[BUFFER_SIZE];
int a;
InputStream is = event.getFile().getInputstream();
while (true) {
a = is.read(buffer);
if (a < 0) {
break;
}
out.write(buffer, 0, a);
out.flush();
}
out.close();
is.close();
} catch (IOException e) {
alert.ErroreContext(e.toString());
}
}
During the handler i can't lock user interface (for example with a modal dialog using p:dialog and p:ajaxstatus).
Where i'm wrong?