Quantcast
Channel: Alfresco Forums - Alfresco API
Viewing all articles
Browse latest Browse all 252

CMISRunTimeException Uploading 20 MB File

$
0
0

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.


Viewing all articles
Browse latest Browse all 252

Trending Articles