on 03-08-2007 9:53 AM
Hi All,
What excatly my requeriment is, I need to Upload Image and display in View.
I wrote Code like this
byte []by=new byte[wdContext.currentContextElement().getResource().read(true).available()];
wdContext.currentContextElement().getResource().read(true).read(by);
wdContext.currentContextElement().setData(by);
Here getResource-- it is value Attibute. it is assined to FileUpload UI Element.
I am getting total Image data to <b>by</b> variable.
My Problem is how to display image with that byte variable(<b>by</b>).
Please give solution to this problem or give any other solutions........
Thanks
SatyaSunil
Hallo Satya,
the following solution is only applicable in NW 04s:
<b>Context Definition</b>
Node:Resource
|_ Attribute: <i>UploadImgResource </i>: Resource
|_ Attribute: <i>UploadImgURL</i> : String
<b>View Layout</b>
FileUpload-resource -> bound to context attribute <i>UploadImgResource</i>
Image-source -> bound to context attribute <i>UploadImgURL</i>
<b>View Controller Coding</b>
//@@begin javadoc:onActionUploadImg(ServerEvent)
/** Declared validating event handler. */
//@@end
public void onActionUploadImg(
com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent,
com.sap.tc.wd.tut.fileupdownload.comp.wdp
.IPrivateTableView.IResourcesElement resourceElement )
{
//@@begin onActionUploadImg(ServerEvent)
// if a file in the FileUpload field exists
if (resourceElement.getUploadImgResource() != null) {
// copy URL string from IWDResource object to
// context attribute 'UploadImgURL'. Image gets
// visible on the UI based on data binding definition.
resourceElement.setUploadImgURL(
resourceElement.getUploadImgResource().getUrl(
WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
}
//@@end
}
Best regards, Bertram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Go through the sample application,
Regards,
Azaz Ali.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The Image control requires a file name of the image in source property,
the file should be in your mimes of your project.
You can create a file and place it in the mimes folder and give the name of the
file in the source property
This is not the preferred solution, but you can try it.
Regards
Abhimanyu L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.