AnsweredAssumed Answered

CMISRunTimeException Uploading 20 MB File

Question asked by hari on Dec 11, 2015
Latest reply on Dec 14, 2015 by hari
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();
   }

Help me with your thoughts how I can fix this. Thanks.

Regards,
Hari.

Outcomes