有没有人在 Liferay 6.1 中尝试过多个文件上传。我试图以与 6.0 相同的方式进行操作,但失败得很厉害。我看到页面左上角的开始链接而不是 portlet。当我单击它并选择一些文件时,控件不会转到我的 portlet。我检查了我的 portlet.xml 并验证了 portlet-class 是否正确。这是jsp中的片段
<liferay-portlet:actionURL doAsUserId="<%= user.getUserId() %>" windowState="pop_up" name="uploadFile" var="uploadFileURL" >
<portlet:param name="jspPage" value="/html/fileuploadportlet/view.jsp" />
</liferay-portlet:actionURL>
<div class="lfr-dynamic-uploader">
<div class="lfr-upload-container" id="<portlet:namespace />fileUpload"></div>
</div>
<div id="<portlet:namespace/>fallback"></div>
<aui:script use="liferay-upload">
new Liferay.Upload({
allowedFileTypes: '<%= StringUtil.merge(PrefsPropsUtil.getStringArray(PropsKeys.DL_FILE_EXTENSIONS, StringPool.COMMA)) %>',
container: '#<portlet:namespace />fileUpload',
maxFileSize: <%=Long.parseLong(PrefsPropsUtil.getString(PropsKeys.DL_FILE_MAX_SIZE)) %> / 1024,
namespace:'<%=renderResponse.getNamespace()%>',
uploadFile: '<%=uploadFileURL.toString()%>',
buttonHeight: 100,
buttonText: 'BEGIN',
buttonWidth: 100,
onFileComplete: function(){alert('fileComplete');},
onUploadError: function(){alert('error');}
});
</aui:script>
这是我的 portlet 的 processAction 方法
@Override
public void processAction(ActionRequest actionRequest,
ActionResponse actionResponse) throws IOException, PortletException {
System.out.println("Something");
UploadPortletRequest uploadRequest=PortalUtil.getUploadPortletRequest(actionRequest);
File file =uploadRequest.getFile("file");
System.out.println(file.getName());
for(int i=0;i<50000;i++){
System.out.println("Something");
}
}