cancel
Showing results for 
Search instead for 
Did you mean: 

How to read the complete path in file upload UI

former_member182205
Participant
0 Kudos

Hi,

I want to know how to read the complete path in file upload UI in java web dynpro.

I have created 1 file upload UI and than when i do browse and select some file say small.jpg from my local PC, desktop , its path is coming in file upload UI like E:\small.jpg,

I want to know how to get this path in java webdynpro code.

Also I want to save that JPG image file whichever end user selects from his desktop using file upload UI to portal server in some specific path, how to save this image file in portal server. I have created 1 folder with name IMAGE in portal server and in that i want to save all the images, how to do that ? path of IMAGE folder is /usr/sap/IMAGE

please let me know..

Edited by: User Satyam on May 11, 2011 8:43 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

you don't need know the path when choosing file.you just need to create a attribute with type com.sap.ide.webdynpro.uielementdefinitions.Resource and bind it to your file upload ui.

this attribute store the content of your upload file.you must crate another button and action to handle the attribute

And you may need use ECM to manage your attachments.

pradeep_kumar5
Active Participant
0 Kudos

Hi Satyam,

In webdynpro java, first file stores in server location then it reads from server.

Create a button with upload and write this code OnAction

Resource is the attribute name in context of type com.sap.ide.webdynpro.uielementdefinitions.Resource, this attribute is for Resource property for Upload UI Element.

Then in OnAction of button

InputStream text = null;

int temp=0;

try{

File file = new File(wdContext.currentContextElement().getResource().getResourceName().toString());

}

String path = file.getAbsolutePath();

wdComponentAPI.getMessageManager().reportSuccess(path);

}catch(Exception e){

e.printStackTrace();

}

//@@end

}

By default it stores in location E:\usr\sap\CE7\J00\j2ee\cluster\server0\sample.jpg

Regards,

Pradeep