I have created a folder in document library and then trying to upload a .xls or .xlsx file to this folder programmaticaly. This is working fine when I am trying to run it on local server. However when I am running it in shared environment, it is somehow appending .null to the file name and giving following error -
Error occured while storing input file in Document Library folder
com.liferay.documentlibrary.FileExtensionException: upload_00000383.xlsx.null
Here is the code I am using for this -
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long realUserId = themeDisplay.getRealUserId();
long groupId = themeDisplay.getLayout().getGroupId();
ServiceContext serviceContext = new ServiceContext();
serviceContext.setScopeGroupId(groupId);
DLFolder folder = DLFolderLocalServiceUtil.addFolder(realUserId, groupId, 0, "TestFolderName","Test Folder Description", serviceContext);
UploadPortletRequest uploadPortletRequest = PortalUtil.getUploadPortletRequest(request);
File file = uploadPortletRequest.getFile("path");
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.addFileEntry(realUserId,groupId,folder.getFolderId(), file.getName(), file.getName(), "", "", folderName, file, serviceContext);
Anyone having any idea why .null might be getting appended to file name during upload?
请登录并以举报不当内容。