Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
Yegor Bondar
Download file from DLibrary.
9 settembre 2011 2.43
Risposta

Yegor Bondar

Punteggio: New Member

Messaggi: 21

Data di Iscrizione: 23 agosto 2011

Messaggi recenti

Good day!
We have portlet where we post all files from DL. We get DLFileEntries and work with it.
And now we need download file(standard download dialog of browser) when user click on link of file.
How can i get download link of DLFileEntry and download file?
Manikandan S
RE: Download file from DLibrary.
9 settembre 2011 2.48
Risposta

Manikandan S

Punteggio: Expert

Messaggi: 492

Data di Iscrizione: 15 settembre 2010

Messaggi recenti

You should see the source code for document library display portlet
Hajri Mohamed
RE: Download file from DLibrary.
9 settembre 2011 3.09
Risposta

Hajri Mohamed

Punteggio: Junior Member

Messaggi: 71

Data di Iscrizione: 2 marzo 2011

Messaggi recenti

hi,
i think there is two different approach to do this :
1- try to build a URL just like the one of document library (when you take your mouse over a file you will have some URL)
i can help you in this, your URL should be like this,
http://ServerName:port/documents/groupId/folderId/fileEntryTitle?version=SomeVersion
i will explan now : ServerName is your server name (exp localhost), port is server port (like 8080), documents is hard coded, it means it's not a varialbe, groupId is the groupId that have the document library displaying the needed file, folderID is the folder id where the file is situated, finally version is the last file version, all this variables you can get them from fileEntry object, so you can then build the URL

2- if i remember, there is a method called getFIleEntry as ImputStream , you will have to redirect it to an outputStream that the browser will detect as a file

regards