Foros de discusión

File Upload & other form fields not getting captured

thumbnail
Asif Billa, modificado hace 8 años.

File Upload & other form fields not getting captured

New Member Mensajes: 15 Fecha de incorporación: 4/05/15 Mensajes recientes
Hi Everyone,

I am facing a strange issue, In my Portlet there are Below fields.
1. File Upload
2. Feed Type (Drop down)
3. Comments (Text Area)

Now when I am using enctype="multipart/form-data" in my Portlet class to fetch form data fields from jsp, I am getting value for the File Property like File name , size etc. but I am not getting values for other fields like Feed Type dropdown selected value and the entered comments value.
On the other hand when I am removing the enctype="multipart/form-data, then I am getting the field values for Feed Type & Comments but the File properties are coming as null.

Scenario 1: Providing enctype="multipart/form-data" in the aui:form tag
O/P: Uploaded file properties are coming but others are coming as null.

<aui:form name="uploadFileForm" enctype="multipart/form-data" method="POST" action="<%= uploadFileURL.toString() %>">
<aui:input type="file" name="fileName" label="File (format: PRGM_YYYYMM_FeedType_v#.csv)" helpMessage="Upload the Transaction Feed"/><br/>
<aui:input type="textarea" name="comments" label="Comments" helpMessage="Enter Comments"/>
<aui:select label="Feed Type" name="feedType" helpMessage="Select Feed Type from Dropdown">
<aui:option label="Location" value="Location" />
<aui:option label="Policy" value="Policy" />
</aui:select>
<aui:button type="submit" value="Send" />
</aui:form>

Scenario 2:
O/P: File Properties are coming as null
<aui:form name="uploadFileForm" method="POST" action="<%= uploadFileURL.toString() %>">
<aui:input type="file" name="fileName" label="File (format: PRGM_YYYYMM_FeedType_v#.csv)" helpMessage="Upload the Transaction Feed"/><br/>
<aui:input type="textarea" name="comments" label="Comments" helpMessage="Enter Comments"/>
<aui:select label="Feed Type" name="feedType" helpMessage="Select Feed Type from Dropdown">
<aui:option label="Select Feed Type" value="" />
<aui:option label="ClaimHeader" value="ClaimHeader" />
<aui:option label="ClaimDetail" value="ClaimDetail" />
<aui:option label="Location" value="Location" />
<aui:option label="Policy" value="Policy" />
</aui:select>
<aui:button type="submit" value="Send" />
</aui:form>

Portlet.java
------------------------------------------------------------------------
UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);
String comments = ParamUtil.getString(actionRequest, "comments");
String feedType = ParamUtil.getString(actionRequest, "feedType");
System.out.println(bookTitle+comments+feedType+" File Name: "+uploadRequest.getFileName("fileName"));

So My query is , is it the enctype="multipart/form-data" which is mandatory for File Upload feature.
If I want to get File properties along with other aui: form fields , then what will be the approach ?

Please suggest
thumbnail
Asif Billa, modificado hace 8 años.

RE: File Upload & other form fields not getting captured

New Member Mensajes: 15 Fecha de incorporación: 4/05/15 Mensajes recientes
I got It in another thread.

PFB the link for the same.
https://www.liferay.com/community/forums/-/message_boards/message/54851442
thumbnail
Meera Prince, modificado hace 8 años.

RE: File Upload & other form fields not getting captured

Liferay Legend Mensajes: 1111 Fecha de incorporación: 8/02/11 Mensajes recientes
HI
Go through following site which may help you more.

http://www.liferaysavvy.com/

Regards,
Meera Prince
thumbnail
Vishal Kumar, modificado hace 8 años.

RE: File Upload & other form fields not getting captured

Regular Member Mensajes: 198 Fecha de incorporación: 12/12/12 Mensajes recientes
I think it is solved?. Right?