The problem that occurs to me happens when selecting a pdf of 4 pages the fileUpload shows a window in which it loads 260 parts, what happens in this case is that it cuts the pages into 65 parts, if you upload 1 pdf with 1 single page, it cuts it into 10 parts, because of this I think there is a configuration that generates this behavior.
What I want is for the document to go up as is the original in the number of pages and not to be cut.
xhtml
<p:fileUpload
disabled="#{allowUploadDocument}"
fileUploadListener="#{handleFileUpload}"
label="#{msg['label.document.choose']}"
cancelLabel="#{msg['label.document.cancel']}"
uploadLabel="#{msg['label.document.update']}"
invalidFileMessage="#{msg['label.document.invalid_format']}"
invalidSizeMessage="#{msg['label.document.invalid_size']}"
fileLimitMessage="#{msg['label.document.filelimitmessage']}"
mode="advanced" dragDropSupport="false" multiple="true"
update="uploadGrid :message" sizeLimit="100000000"
fileLimit="3"
allowTypes="/(\.|\/)(txt|doc?x|gif|jpe?g|png|pdf|exe|xls|xlsx|doc)$/"
id="documentAttached" skinSimple="true" />
public void handleFileUpload(FileUploadEvent event) {
logger.debug("handleFileUpload ");
UploadedFile file = event.getFile();
String fileName = file.getFileName();
String path = new String();
if (document.getSeries().getHasSubseries()) {
path = document.getSeries().getName() + "/" + document.getSubseries().getName() + "/"
+ document.getDocumentalType().getName() + "/" + document.getRadicatedNumber();
} else {
path = document.getSeries().getName() + "/" + document.getDocumentalType().getName() + "/"
+ document.getRadicatedNumber();
}
logger.debug("ruta para subir archivo:" + path);
DocumentAttachedData attachedFileData = new DocumentAttachedData(fileName, path + "/" + fileName);
attachedFileData.setContent(file.getContents());
attachedFileData.setDocumentPath(path);
attachedFileData.setType(getMimeType(file.getContentType()).name());
List<DocumentAttachedData> fileList = document.getAttachedFiles();
fileList.add(attachedFileData);
document.setAttachedFiles(fileList);
}