Friday, July 17, 2015

Document and Media Portlet in Liferay

Today we will discuss Document and Media portlet of Liferay.This portlet is very useful to store documents so that we can use these like we provide user a facility to download the files etc.  Here we will discuss how to create folder and save images or documents in folder and how to access it. Also i show you  tables where the enties are stored. 

So lets start this step by step:-

Step 1:-Create Folder
Click on Admin-->Content-->Document and Media-->Add-->Folder-->Provide name and description and click save

Step 2:-Check Database tables
Open your database and check the following tables:-

Their table contain many fields like groupId,companyId,usedId,
title,description etc.

Here i show only selected fields,this table contain many more fields.This table contain entry each time you create some assets like upload file ,create web content etc.

Every time you create a folder or add document this table is updated.

Note :-classpk in assetentry and typePk in dlsyncevent are same.

This is the main table which contain the folder entries like userId, companyId, name ,description,folderId ,createdate, modifieddate, path etc.

Step 3:-Add File to Created Folder
Click on Admin-->Content-->Document and Media-->Click liferayiseasy (folder)-->Add -->Select Basic Document

Now Choose the document provide title and description of your document and click Publish.

After publish your file appear in the folder you can see it by clicking on the file.Also you get the download Url as:-

Step 4:-Check Database tables
Open your database and check the following tables:-

Now see the mime type because we upload image so entry is image/jpeg.Other values are like video/mp4 etc.


This table contain the main entries related to the document like extension,size,folderId, title etc.

Here this table contain many other coloumns i just show some.

Note:- Check the folderId is 12401 which is same as folderId in dlfolder table.

This table is used to store the thumbnails of the images.

Here reference key is fileEntryId which is same as of dlFileEntry table fileEntryId.

Note:- No thumbnail is created for text or pdf files.

This table contain the information about file version.

Step 5:-Check Location of files
Open your server directory in your machine .Your image will show :-

Image Path:-

From Database(dlfileentry):-

Step 6:-Check Location of Thumbnail
Open your server directory in your machine .Your image will show

Thumbnail Path:-\document_library\10154\0\document_thumbnail\10181\116\12404\12405.jpg

From Database:-
  • Green Color entries are from dlfileentrymetadata table.
  • Black entries are from dlfileentry table.
  • 116 This value is come from a method getDividentPath which is specified in DLImpl class.

In the next tutorial  Folder and File Upload Programatically in Liferay we will add folder and files by using APIs method . 

No comments:

Post a Comment

Total Pageviews

Number Of Unique Visitor

Free counters!