cancel
Showing results for 
Search instead for 
Did you mean: 

Upload File Check

former_member192766
Participant
0 Kudos

Hi,

In a Web Dynpro for JAVA application, I just want to allow upload of .doc and .pdf files.

Any idea how to do this?

Many Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

create a file upload ui element

in the onAction property of the ui elem bind a action UPLOAD

create two context elem

fname (bind to filename property of the ui elem)

fdata (bind to the data property of the ui elem)

in the UPLOAD method use th following code

IWDAttributeInfo attributeInfo = wdContext.getNodeInfo().getAttribute(IPrivateMyView.IContextElement.FDATA);

IWDModifiableBinaryType btype = (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();

IContextElement elem = wdContext.currentContextElement();

if(elem.getFData()!= null)

{

try

{

wdComponentAPI.getMessageManager().reportSuccess("File " + btype.getFileName() + " was uploaded ");

}

catch(Exception e)

{

throw new WDRuntimeException(e);

}

}

else

{

wdComponetAPI.getMessageManager().reportException("error in upload", true);

}

Regards

Jayapriya

ravindra_bollapalli2
Active Contributor
0 Kudos

hi

this is one way of uploading the file

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/302bdc70-9ece-2b10-e9b6-c7309eab...

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/00062266-3aa9-2910-d485-f1088c3a...

/people/bertram.ganz/blog/2007/05/25/new-web-dynpro-java-tutorials--uploading-and-downloading-files-in-sap-netweaver-70

bvr

Edited by: bvr on Feb 6, 2009 6:05 PM