Search code examples
javaeclipseliferayportletliferay-6

Liferay Developer Studio not resolving package com.liferay.portal.upload


I'm trying to customize the Liferay Web Forms portlet to accept a file control, and I've just about gotten everything working except for the UploadPortletRequest to handle the actual uploading of the file from the form!

I've got:

import com.liferay.portal.upload.UploadPortletRequestImpl;

and in the compiler output:

[javac] 1. ERROR in C:\Program Files\Liferay Developer Studio\liferay-plugins-sdk-6.0-ee-sp2-20110727\portlets\AZ_WebForms-portlet\docroot\WEB-INF\src\com\liferay\autozone\webform\portlet\AZ_WebForm.java (at line 34)
[javac]     import com.liferay.portal.upload.UploadPortletRequestImpl;
[javac]            ^^^^^^^^^^^^^^^^^^^^^^^^^
[javac] The import com.liferay.portal.upload cannot be resolved

BUT...If I add portal-impl.jar to the Portal Dependency JARs to be able to resolve the class, it won't compile because portal-impl.jar is in WEB-INF/lib!! (and it doesn't like that)

I'm kind of at a loss here. What do I need to do?


Solution

  • You can't use anything from portal-impl.jar, unless you use ext environment and you modify Liferay.

    From your compiler output I would say that you are writing your own portlet, not customizing existing. Am I wrong?

    You must handle upload your self. Yyou can use Apache commons fileupload, it supports portlets.

    Pleas see Using FileUpload, specifically Servlets and portlets part