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:-

a)assetentry
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.


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



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

c)dlfolder
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:-

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



b)dlsyncevent




c)dlfileentry
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.

d)dlfileentrymetadata
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.

e)dlfileversion
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:-
..\liferay-portal-6.2.0\data\document_library\10154\12401\201\1.0

From Database(dlfileentry):-
..\document_library\companyId\folderId\name\version


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

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

From Database:-
..\document_library\companyId\fileEntryTypeId\document_thumbnail\repositoryId\116\fileEntryId\fileVersionId\extension
  • 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 .