cancel
Showing results for 
Search instead for 
Did you mean: 

uploading downloading

Former Member
0 Kudos

Hi All,

I am uploading an image file using the tutorial

Uploading and Downloading Files in Web Dynpro Tables

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/b0e10426-77ca-2910-7eb5-d7d8982c...

now wen i upload this image file it will be uploaded on the server can any one tel me the method of displaying the image I have uploaded in my next view??

should i use the image ui element ??

PDfs articles blogs would be helpful

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi nikhil,

use 3 UI elements..

1file upload.

2 link toAction

3 image

now create a value node n create 2 attrubutes for that value node

now map data n resouce property of fileupload wid first value attribute of node.

Its possible to do in same window..

I'll send u full code via mail...

Regards

Khushboo

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Use FileDownload UI Element for this,

Take two context attrbutes

"resorce" of type bind this to 'resorce' property of FileDownload com.sap.ide.webdynpro.uielementdefinitions.Resource

"src" of type String and bind it to 'data' property

Then write the following code

File f=new File(<fileName>);

FileInputStream fis = new FileInputStream(f);

FileChannel fc = fis.getChannel();

byte[] data = new byte[(int)(fc.size())];

ByteBuffer bb = ByteBuffer.wrap(data);

fc.read(bb);

IWDCachedWebResource objCachedWebResource = null;

if (data != null)

{

objCachedWebResource = WDWebResource.getWebResource(data,WDWebResourceType.JPG_IMAGE);

objCachedWebResource.setResourceName(f.getName());

}

wdContext.currentContextElement().setResource(objCachedWebResource.getAbsoluteURL());

wdContext.currentContextElement().setReso(objCachedWebResource);

Regards

LN

Former Member
0 Kudos

Hi laxmi,

Thanks for ur quick reply , by using this code can i display this image in the webdynpor view itself??

i do not want to open or save it in another window...

Former Member
0 Kudos

Hi,

We use LinkToURL or FileDownload UI elements to get files stored in

server. Both will open files in new window only. Let's wait for expert's

reply for your question. As far as I know , it's not supported

Regards

LN