Downloading files from a document library portlet programmatically


In this example I have manually added  Uuid from the table ‘dlfileentry’.

<%@page import="java.util.Date"%>
<%@page import="com.liferay.portlet.documentlibrary.model.DLFileEntry"%>
<%@page import="com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil"%>
<%@page import="com.liferay.portlet.documentlibrary.model.DLFolder"%>
<%@page import="com.liferay.portlet.documentlibrary.service.DLFolderLocalServiceUtil"%>
<%@page import="javax.mail.Folder"%>
<%@page import="com.liferay.portal.kernel.util.StringPool"%>
<%@page import="com.liferay.portlet.documentlibrary.util.DLUtil"%>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@taglib uri="http://liferay.com/tld/theme" prefix="theme" %>
<%@taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %>
<%@ page import="com.liferay.portlet.documentlibrary.util.DLUtil" %>
<theme:defineObjects/>
<portlet:defineObjects/>
<%

String s1="d8f650fd-a737-4bb8-9437-768c9194c1c8";
String s2="96c65a86-fa0e-4223-9d1e-be1bb9de5db7";
String s3="bf896c2a-34e8-482d-8e8e-a12c6c6e8163";
%>
  <liferay-ui:icon image="download"  message="IPC Examples"/>           
<a href='<%=themeDisplay.getPortalURL()+"/c/document_library/get_file?uuid="+s1+"&groupId="+themeDisplay.getScopeGroupId() %>' >
MyFile1 </a><br>
<liferay-ui:icon image="download" message="JQuery Examples"/>
<a href='<%=themeDisplay.getPortalURL()+"/c/document_library/get_file?uuid="+s2+"&groupId="+themeDisplay.getScopeGroupId() %>' >
MyFile 2</a><br>
<liferay-ui:icon image="download" message="Computer Graphics download"/>
<a href='<%=themeDisplay.getPortalURL()+"/c/document_library/get_file?uuid="+s3+"&groupId="+themeDisplay.getScopeGroupId() %>' >

MyFile3 </a>

Search This Blog

All the rights are reserved to this blog is belongs to me only.. Powered by Blogger.