Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
public void uploadDocuments(DocumentManagement dm){
try {
File dir = new File("D:\\folder");
File[] files = dir.listFiles();
GregorianCalendar gregorianCalendar = new GregorianCalendar();
DatatypeFactory datatypeFactory = DatatypeFactory.newInstance();
XMLGregorianCalendar date = datatypeFactory.newXMLGregorianCalendar(gregorianCalendar);
for (File file : files) {
if (file.isFile()) {
InputStream in = new FileInputStream(file);
byte[] bytes = IOUtils.toByteArray(in);
Attachment attach = new Attachment();
attach.setFileName(file.getName());
attach.setFileSize(file.getTotalSpace());
attach.setContents(bytes);
attach.setCreatedDate(date);
attach.setModifiedDate(date);
dm.createSimpleDocument(5315, file.getName(), attach);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}