<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <title>Problem with form enctype="multipart/form-data"</title>
  <link rel="self" href="https://liferay.dev/ar/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=17843507" />
  <subtitle>Problem with form enctype="multipart/form-data"</subtitle>
  <id>https://liferay.dev/ar/c/message_boards/find_thread?p_l_id=119785294&amp;threadId=17843507</id>
  <updated>2026-06-12T16:11:54Z</updated>
  <dc:date>2026-06-12T16:11:54Z</dc:date>
  <entry>
    <title>RE: Problem with form enctype="multipart/form-data"</title>
    <link rel="alternate" href="https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=54851442" />
    <author>
      <name>Asif Billa</name>
    </author>
    <id>https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=54851442</id>
    <updated>2015-06-06T14:54:23Z</updated>
    <published>2015-06-06T14:54:23Z</published>
    <summary type="html">Thanks Richard,&lt;br /&gt;&lt;br /&gt;I was facing the same problem.&lt;br /&gt;I applied your approach and it get solved. &lt;img alt="emoticon" src="@theme_images_path@/emoticons/happy.gif" &gt;</summary>
    <dc:creator>Asif Billa</dc:creator>
    <dc:date>2015-06-06T14:54:23Z</dc:date>
  </entry>
  <entry>
    <title>RE: Problem with form enctype="multipart/form-data"</title>
    <link rel="alternate" href="https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=33597038" />
    <author>
      <name>giacomo savino</name>
    </author>
    <id>https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=33597038</id>
    <updated>2014-01-29T13:00:04Z</updated>
    <published>2014-01-29T13:00:04Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;&lt;div class="quote-title"&gt;Manish Yadav:&lt;/div&gt;&lt;blockquote&gt;Hi  Bothia&lt;br&gt; Might be  this code will help you&lt;br&gt;&lt;br&gt;&lt;strong&gt;JSP&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
public void sendEmail(ActionRequest request, ActionResponse response) {
   UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(request);
   File file = uploadRequest.getFile("file");
   String email = ParamUtil.getString(uploadRequest, "fromemail");
}
&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;Thank you&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>giacomo savino</dc:creator>
    <dc:date>2014-01-29T13:00:04Z</dc:date>
  </entry>
  <entry>
    <title>RE: Problem with form enctype="multipart/form-data"</title>
    <link rel="alternate" href="https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=23518282" />
    <author>
      <name>Manish Yadav</name>
    </author>
    <id>https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=23518282</id>
    <updated>2013-04-10T16:05:50Z</updated>
    <published>2013-04-10T16:05:50Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi  Bothia&lt;br&gt; Might be  this code will help you&lt;br&gt;&lt;br&gt;&lt;strong&gt;JSP&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
public void sendEmail(ActionRequest request, ActionResponse response) {
   UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(request);
   File file = uploadRequest.getFile("file");
   String email = ParamUtil.getString(uploadRequest, "fromemail");
}
&lt;/code&gt;&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Manish Yadav</dc:creator>
    <dc:date>2013-04-10T16:05:50Z</dc:date>
  </entry>
  <entry>
    <title>RE: Problem with form enctype="multipart/form-data"</title>
    <link rel="alternate" href="https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=23516289" />
    <author>
      <name>josmar Alarcon Bothia</name>
    </author>
    <id>https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=23516289</id>
    <updated>2013-04-10T15:21:26Z</updated>
    <published>2013-04-10T15:21:26Z</published>
    <summary type="html">good morning, hey I have the same problem, implement what you commented on the UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest (ActionRequest), but I want to take the value of a text box, you know this to be due or q can happen ?</summary>
    <dc:creator>josmar Alarcon Bothia</dc:creator>
    <dc:date>2013-04-10T15:21:26Z</dc:date>
  </entry>
  <entry>
    <title>RE: Problem with form enctype="multipart/form-data"</title>
    <link rel="alternate" href="https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=17843543" />
    <author>
      <name>Richard Kosegi</name>
    </author>
    <id>https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=17843543</id>
    <updated>2012-11-11T13:36:43Z</updated>
    <published>2012-11-11T13:36:43Z</published>
    <summary type="html">OK, I figure it out.&lt;br /&gt;&lt;br /&gt;I need to use this:&lt;br /&gt;&lt;br /&gt;UploadPortletRequest uploadRequest = PortalUtil.getUploadPortletRequest(actionRequest);&lt;br /&gt;long itemId = ParamUtil.getLong(uploadRequest,&amp;#34;itemId&amp;#34;);&lt;br /&gt;&lt;br /&gt;instead of &lt;br /&gt;&lt;br /&gt;long itemId = GetterUtil.getLong(actionRequest.getParameter(&amp;#34;itemId&amp;#34;));</summary>
    <dc:creator>Richard Kosegi</dc:creator>
    <dc:date>2012-11-11T13:36:43Z</dc:date>
  </entry>
  <entry>
    <title>Problem with form enctype="multipart/form-data"</title>
    <link rel="alternate" href="https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=17843506" />
    <author>
      <name>Richard Kosegi</name>
    </author>
    <id>https://liferay.dev/ar/c/message_boards/find_message?p_l_id=119785294&amp;messageId=17843506</id>
    <updated>2012-11-11T13:29:31Z</updated>
    <published>2012-11-11T13:29:31Z</published>
    <summary type="html">&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;Hi liferay folks,&lt;br&gt;&lt;br&gt;I have problem with such form.When I add  enctype="multipart/form-data" to allow file uploads, &lt;br&gt;GetterUtil.getLong(actionRequest.getParameter("itemId")) returns allways zero (also title is empty).&lt;br&gt;&lt;br&gt;Without enctype it works just fine, but I can not upload file.&lt;br&gt;&lt;br&gt;What I'm missing in my code?&lt;br&gt;&lt;br&gt;&lt;strong&gt;edit_item.jsp&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
&amp;amp;lt;%
long itemId = 10;
String title = "Test";
%&amp;amp;gt;

&amp;lt;liferay-portlet:actionurl name="updateItem" var="updateItemURL"&amp;gt;
&amp;lt;/liferay-portlet:actionurl&amp;gt;

	&amp;lt;aui:form action="&amp;lt;%= updateItemURL %&amp;gt;" method="post" name="fm" enctype="multipart/form-data"&amp;gt;
		&amp;lt;aui:input name="itemId" type="hidden" value="&amp;lt;%= String.valueOf(itemId) %&amp;gt;" /&amp;gt;
                &amp;lt;aui:input name="itemLogo" type="file" label="stock.item.label.file" /&amp;gt;
		&amp;lt;aui:button-row&amp;gt;
			&amp;lt;aui:button class="aui-button-input" type="submit" value="&amp;lt;%= title  %&amp;gt;" /&amp;gt;
		&amp;lt;/aui:button-row&amp;gt;			
	&amp;lt;/aui:form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;br&gt;&lt;br&gt;&lt;strong&gt;StockPortlet.java&lt;/strong&gt;&lt;br&gt;&lt;pre&gt;&lt;code&gt;
public void updateItem(ActionRequest actionRequest, ActionResponse actionResponse)
			throws IOException, PortletException {
		
		actionResponse.setRenderParameter("jspPage", "/jsp/stock/view_items.jsp");

		ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);
		String title = GetterUtil.getString(actionRequest.getParameter("title"));
		long itemId = GetterUtil.getLong(actionRequest.getParameter("itemId"));

        }

&lt;/code&gt;&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;</summary>
    <dc:creator>Richard Kosegi</dc:creator>
    <dc:date>2012-11-11T13:29:31Z</dc:date>
  </entry>
</feed>
