cancel
Showing results for 
Search instead for 
Did you mean: 

File Upload UI not Working

Former Member
0 Kudos

Hi all,

I am using File Upload UI for one my application, for that i created a context attribute of type

com.sap.ide.webdynpro.uielementdefinitions.Resource

, i placed one button which has the action whether any file was selected or not.

public void onActionuploadSelectedFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    if(wdContext.currentContextElement().getCaResource()!=null)
    {
    	wdComponentAPI.getMessageManager().reportSuccess("File Selected");
    }
    else
    {
		wdComponentAPI.getMessageManager().reportSuccess("File not Selected");
    }

i am getting the message

File not Selected

when no file was seleted. But when i select a file i am not getting any message.

Kindly help me and let me know where is the actual problem....

Currently I am using NWDS 7.0.11

Thanks & Regards,

Chandran S

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Finally the issue was solved by refering the thread

The multipart-form is never parsed. To do so, we have to

start Visual Admin, then

go to "Cluster" tab/Server .../Services/Web Container,

then tab Properties,

then change MultipartBodyParameterName from "empty string" to "com.sap.servlet.multipart.body"

Thanks & Regards,

Chandran S

Former Member
0 Kudos

Hi All,

The other issue related to this File Upload UI, its masking the functionalities of the other UI elements in the screen if any file already selected in that File Upload UI element. The other UI's are wroking fine if nothing is selected in that File Upload UI.

Kindly help me to resolve the issue.....

Thanks in Advance.

Thanks & Regards,

Chandran S

Former Member
0 Kudos

Hi,

See the code & procedure in sample project in below link. Hope this helps.

/docs/DOC-8061#41 [original link is broken]

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081...

Regards,

Charan

Former Member
0 Kudos

Hi Charan,

I already downloaded this sample code and executed not working, for me the issue is different, as i already mentioned i am not able to get the file contents and also if a file is selected in file upload UI, the other UI functionalities are getting masked.

Kindly help me in resloving this issue.

Regards,

Chandran S

Former Member
0 Kudos

Hi,

Please carefully check the below properties(cardinality, selection && types) and bindings.

1. Create a value node(Ex: ctx_vn_FileData) of cardinality 0..1 and selection 0...1

2. Create a context attribute(Ex: ctx_va_FileResource) of

type "com.sap.ide.webdynpro.uielementdefinitions.Resource" under this node.

3. Check you binded this context attribute to resource property of FileUpload UI element.

4. Now you can get the value of this resource using below code.

IPrivateUploadFileKM_View.ICtx_vn_FileDataElement element = wdContext.currentCtx_vn_FileDataElement();
IWDResource resource = element.getCtx_va_FileResource();

4. You can get the resource(file) name & resource(file) extension using below code.

//Read the File
InputStream stream = resource.read(true);
String resourceName = resource.getResourceName();
String resourceExtn = resource.getResourceType().getFileExtension();

Check that you did all these as it is??

Regards,

Charan

Former Member
0 Kudos

Hi Charan,

I did the same thing suggested by you, but the issue remains same, i am not able to retrive the file Contents, Name etc.. from the resource.

Thanks & Regards,

Chandran S

Former Member
0 Kudos

Hi,

Did you check the cardinality and selection of value node.

Did you print what is there in resource???

What is it showing ??? is it "null" or giving error??

Regards,

Charan

Former Member
0 Kudos