<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Obtain Download-URL for DL-File</title>
  <link rel="self" href="https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=45505144" />
  <subtitle>Obtain Download-URL for DL-File</subtitle>
  <id>https://liferay.dev/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=45505144</id>
  <updated>2026-04-04T00:58:15Z</updated>
  <dc:date>2026-04-04T00:58:15Z</dc:date>
  <entry>
    <title>RE: Obtain Download-URL for DL-File</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119186641" />
    <author>
      <name>Christoph Rabel</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119186641</id>
    <updated>2020-05-19T07:08:14Z</updated>
    <published>2020-05-19T07:08:14Z</published>
    <summary type="html">Here&amp;#39;s one solution, it depends a bit, where you start. If you already have a fileentry, you also can use the approach above and concatenate the url yourself. It works pretty well, I have used that approach now for years, never run into problems.&lt;br /&gt;If you have just an ADT, some numbers, an assetentry, ... you need to use the serviceLocator:&lt;br /&gt;&lt;a href="https://bitbucket.org/snippets/mrg3kko/pebq6x/liferay-71-adt-get-download-url-for-a"&gt;https://bitbucket.org/snippets/mrg3kko/pebq6x/liferay-71-adt-get-download-url-for-a&lt;/a&gt;&lt;br /&gt;Another approach is to use a Template Context Contributor:&lt;br /&gt;It allows you to inject services into ADTs. You could simply write ${myhelpercontributor.getURLForFile(entryId)} to get the url.&lt;br /&gt;&lt;a href="https://help.liferay.com/hc/en-us/articles/360018170931-Template-Context-Contributor"&gt;https://help.liferay.com/hc/en-us/articles/360018170931-Template-Context-Contributor&lt;/a&gt;&lt;br /&gt;Please note that it only works &amp;#34;as expected&amp;#34; from 7.0.0 DXP SP7 and up:&lt;br /&gt;&lt;a href="https://issues.liferay.com/browse/LPS-76631"&gt;https://issues.liferay.com/browse/LPS-76631&lt;/a&gt;</summary>
    <dc:creator>Christoph Rabel</dc:creator>
    <dc:date>2020-05-19T07:08:14Z</dc:date>
  </entry>
  <entry>
    <title>RE: Obtain Download-URL for DL-File</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119188623" />
    <author>
      <name>Lee Jordan</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=119188623</id>
    <updated>2020-05-18T21:04:24Z</updated>
    <published>2020-05-18T21:04:24Z</published>
    <summary type="html">Freemarker solution?</summary>
    <dc:creator>Lee Jordan</dc:creator>
    <dc:date>2020-05-18T21:04:24Z</dc:date>
  </entry>
  <entry>
    <title>RE: Obtain Download-URL for DL-File</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=45541728" />
    <author>
      <name>Zsolt - Jácint Balogh</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=45541728</id>
    <updated>2014-11-19T09:02:37Z</updated>
    <published>2014-11-19T09:02:37Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi,&lt;br&gt;&lt;br&gt;This worked for me:&lt;br&gt;&lt;pre&gt;&lt;code&gt;

    public static String getDLFileURL(DLFileEntry file) {
        return "/documents/" + file.getGroupId() + BACKSLASH + file.getFolderId() + BACKSLASH
            + file.getTitle() + BACKSLASH + file.getUuid();
    }

&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Regards,&lt;br&gt;Zsolt&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Zsolt - Jácint Balogh</dc:creator>
    <dc:date>2014-11-19T09:02:37Z</dc:date>
  </entry>
  <entry>
    <title>RE: Obtain Download-URL for DL-File</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=45539480" />
    <author>
      <name>Heiko Ottenbacher</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=45539480</id>
    <updated>2014-11-19T08:44:56Z</updated>
    <published>2014-11-19T08:44:56Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hey,&lt;br&gt;&lt;br&gt;I found a solution that seems to work :&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;String url = portalURL + "/c/document_library/get_file?uuid=" + document.getUuid() + "&amp;amp;amp;groupId=" + document.getGroupId();&lt;/code&gt;&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Heiko Ottenbacher</dc:creator>
    <dc:date>2014-11-19T08:44:56Z</dc:date>
  </entry>
  <entry>
    <title>Obtain Download-URL for DL-File</title>
    <link rel="alternate" href="https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=45505143" />
    <author>
      <name>Heiko Ottenbacher</name>
    </author>
    <id>https://liferay.dev/c/message_boards/find_message?p_l_id=119785294&amp;messageId=45505143</id>
    <updated>2014-11-18T17:01:04Z</updated>
    <published>2014-11-18T17:01:04Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hey Everybody,&lt;br&gt;&lt;br&gt;I have a problem getting a download-URL for an element of the document-library.&lt;br&gt;&lt;br&gt;First I did it that way:&lt;br&gt;&lt;br&gt;Java&lt;br&gt;&lt;pre&gt;&lt;code&gt;DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry( readingConfirmation.getDocumentId() );
fileEntryUUId = fe.getUuid() &lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;JSP:&lt;br&gt;&lt;pre&gt;&lt;code&gt;&amp;lt;a href="&amp;lt;%= themeDisplay.getPortalURL() + themeDisplay.getPathContext() + &amp;amp;quot;/documents/&amp;amp;quot; + themeDisplay.getScopeGroupId() + StringPool.SLASH + fileEntryUUId %&amp;gt;"&amp;gt;&amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;a href="&lt;%= themeDisplay.getPortalURL() + themeDisplay.getPathContext() + &amp;quot;/documents/&amp;quot; + themeDisplay.getScopeGroupId() + StringPool.SLASH + fileEntryUUId %&gt;"&gt;&lt;br&gt;&lt;br&gt;It worked when trying to download a file inside the same site - but now I placed the portlet to download the file inside "my-dashboard", which is a group-site - and then the ressource cannot be found &lt;img alt="emoticon" src="@theme_images_path@/emoticons/sad.gif"&gt;. It is not a matter of rights - the URL seems not to be generated in the right way.&lt;br&gt;&lt;br&gt;Can someone help me to generate an URL when I have the FileEntry Object or its ID - no matten in what site I am?&lt;br&gt;&lt;br&gt;Also tried that one :&lt;br&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;DLUtil.getPreviewURL(fileEntry, fileEntry.getFileVersion(), themeDisplay, StringPool.BLANK, false, true)&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;Doesnt seem to work either &lt;img alt="emoticon" src="@theme_images_path@/emoticons/sad.gif"&gt;&lt;br&gt;&lt;br&gt;I also have the group/site ID - but how to use it to generate the URL?&lt;br&gt;&lt;br&gt;Thanks in advance!&lt;br&gt;&lt;br&gt;Regards, Heiko&lt;/a&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Heiko Ottenbacher</dc:creator>
    <dc:date>2014-11-18T17:01:04Z</dc:date>
  </entry>
</feed>
