Hi all,
I am trying to use a FileUpload component for a KM upload. After importing the external libraries (like ones from com.sap.netweaver.bc.util, com.sap.netweaver.bc.rf) some errors are still there at the following lines:
FileUpload fileUpload = (FileUpload)this.getComponentByName("myfileupload");
IFileParam fileParam = fileUpload.getFile();
if(fileParam != null)
{
this.mimetype = fileUpload.getFile().getContentType();
this.resource = fileUpload.getFile().getFileName();
..
}
The errors are:
"Cannot cast from Component to FileUpload"
"the method getFile() is undefined for the type FileUpload."
So it does not recognize the method getFile() of the class FileUpload.
I guess the problem is that some more libraries have to be added, but which ones i dont know so far
I have tried with both AbstractPortalComponent and JSPDynPage, but not working anyhow.
Can someone helps me, it took all my day trying to find out.
Best regards,
Raluca.
Hi Raluca.
You are probalbly refering to the wrong FileUpload class! Check your import statements, they should include the following: "import com.sapportals.htmlb.FileUpload;".
A common mistake is to include the following: "import com.sapportals.htmlb.unifiedrendering.controls.FileUpload;"
Hope that helps.
/Fredrik
Add a comment