Liferay UploadRequest getFiles does not create temp files which has size lessthan ~ 1.5 KB or ~ 1 KB

Hello,

If you are using the UploadRequest.getFileNames(“testFiles”) and if you upload file size less than around 1.5 KB Liferay is not creating the temp files and the we can not use those files for saving it in the document library. So the solution would be using the below code.

InputStream[] streams = uploadReq.getFilesAsStream(“testFiles”);
for(InputStream is : streams){
                File file = FileUtil.createTempFile(inputStream);
}

Comments

Popular posts from this blog

Disabling and Enabling Minfying of JS and CSS resources in Liferay

Checking in Liferay permissions for a User in JSON WS or in a normal Java Class