on 05-11-2011 7:39 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.