File upload in specific folder of web application in liferay..?

╄→尐↘猪︶ㄣ 提交于 2019-12-22 11:06:49

问题


I am using liferay 6.0.5. I am uploading file using following code.

UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
String submissionFileName = uploadRequest.getFileName("file");//uploaded filename
File submissionFile = uploadRequest.getFile("file");

this works fine and upload file in tomcat's temp directory with some different name. What I want is.."There is one folder docs in my project directory. I want uploaded file in this directory". How to do this in liferay..?


回答1:


If you want to change the temp directory for the file upload then you can change the following property in portal-ext.properties:

com.liferay.portal.upload.UploadServletRequestImpl.temp.dir=C:/MyTempDir

Hope this is what you are looking for.




回答2:


If you want to add files to Liferay's Document Library then check out the following classes:

http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/documentlibrary/service/DLFileEntryLocalServiceUtil.html

http://docs.liferay.com/portal/6.0/javadocs/com/liferay/portlet/documentlibrary/service/DLFolderLocalServiceUtil.html



来源:https://stackoverflow.com/questions/9922463/file-upload-in-specific-folder-of-web-application-in-liferay

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!