Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to support file upload in web-form Liferay 7?

I need a simple extension for Liferay web form to enahance file attachment to data flled in a liferay 7 web form.

Also need to sent this file as an attachment with the email to the registered user.

I know how to achieve this functionality in liferay 6.2 but not about liferay 7. I am using liferay 7 GA-5 CE.

Any help appreciated.

like image 573
Sandeep Avatar asked Apr 25 '18 06:04

Sandeep


People also ask

How to use forms in Liferay web content?

Simple Way to Use Forms in Liferay Web Content Objective: Use forms in liferay web content. When we need any form submission we need to create form in portlet and later we need maintain this data in one place but this can be done by developer but administrator can’t this. So for this reason we need to embed some forms in web content of liferay.

What is documents and media in Liferay?

Documents and Media provides native storage on your Liferay server for digital assets: documents, images, or videos. You can upload files by dragging and dropping them into a Documents and Media folder or by using the application’s Add button to manually configure file details prior to upload.

How to add web content display portlet in Liferay Portal?

Login as Admin in liferay portal and go to add in the dock bar and add Web Content Display portlet to page. The following screen shows after admin login into liferay portal. The following screen is after add Web Content Display portlet to page Now click on Add web content icon now we will get the CK Editor to design Content

How do I upload files to the documents and media application?

In order to upload files, first navigate to the Documents and Media application in a Site or Asset Library. To access Documents and Media in a Site, open the Site Menu() and go to Content & Data→ Documents and Media. To access Documents and Media in an Asset Library, navigate to any Library where it’s enabled and click on Documents and Media.


1 Answers

You need to create a custom form field type plugin, please find liferay wiki here Creating Form Field Type. and follow below steps,

  1. Change input type to file in soy file path is

    src/main/resources/META-INF/resources/your-plugin-type-name.soy

  2. Create a fragment of dynamic.data.list.form.web bundle and override display/view.jsp to accept the file i.e. multipart data.
  3. Override AddRecordMVCActionCommand action command to store the selected file as you required.
  4. Build and deploy all 3 plugins

Hope this will help you.

like image 157
Dipti Ranparia Avatar answered Oct 08 '22 01:10

Dipti Ranparia