Hi All,
I am using the below code to upload file to Alfresco. It runs fine for smaller sized documents but is failing for files of sizes around 20MB.
public String uploadDocument(String docType, File file)throws IOException, SiteNotFoundException, DocumentLibraryNotFoundException { Map<String, String> props =new HashMap<String, String>(); props.put(PropertyIds.OBJECT_TYPE_ID,"cmis:document"); props.put(PropertyIds.NAME, file.getName()); FileInputStream input =new FileInputStream(file); CUDDocuments docsCUD =new CUDDocuments(); Folder target = docsCUD.getTargetFolder(docType); ContentStream contentStream = MySession.getSession().getObjectFactory() .createContentStream(file.getName(),-1,"application/octet-stream", input); Document doc = target.createDocument(props, contentStream, VersioningState.MAJOR); contentStream.getStream().close();return doc.getId();}
Regards,
Hari.