cancel
Showing results for 
Search instead for 
Did you mean: 

File upload and download through web Dynpro2.0.9. with Java

Former Member
0 Kudos

Hai All,

I am working in web Dynpro2.0.9 with Java.For file upload and download "IWDResource" is used.But this package is not available in web Dynpro2.0.9.How to download and upload files through using this version?

Anyone can help me?

Thanks in Advance,

Kindly Regards,

S.V.Selva Bala.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hai Noufal,

Thank you for your reply.

I need details about file download through web Dynpro 2.0.9. with Java.Your suggestions will help for me.

Thanks in advance,

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Hai Noufal,

I successfully upload the files to the database.

For file download i create two views.

In the first view files are fetched from the database(datatype for the file is image in the database)and it is converted to byte from image.Afterthat the byte is converted to string by using the following code.

byte source[]=new byte[1024];

if(rs.next()){

source=rs.getBytes("cv_document_file");

}

String sourcestr=source.toString();

wdContext.currentContextElement().setDownloadfile(sourcestr);

Now i put the converted string into the second view.In the second view i try to convert the string value into bytes by using the following codes.

String sourcestr=wdContext.currentContextElement().getDownloadfile();

byte bs[]=new byte[1024];

bs=sourcestr.getBytes();

wdContext.currentDownloadElement().setDownloadfile(bs);

But it doesn't work and no error.

Now i am expecting the valuable suggestions from you.

Thanks in Advance,

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Hai Noufal,

Thank you for your immediate reply.Thank you.

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Please close the thread if solved. Also kindly post the solutions.

Noufal

Former Member
0 Kudos

Hai Noufal,

For file storage in database,the datatype given for me is "BLOB".I am using MSSQL.

Now i am using "Image"as the datatype for to store the files.I studied that BLOB,CLOB are possible in Oracle only.In MSSQL ntext,image are used as a data type for file storage.Is any possibility to store files as "BLOB" in MSSQL database.If it is not possible among the ntext,image which one is possible and what is the reason why BLOB is not used in MSSQL.I need valuable suggestion and very soon reply from you.

Thanks in advance,

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Hai Noufal,

Please send some sample codings for file download through web Dynpro2.0.9. with Java.

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Hai Noufal,

With your help i successfully upload the files by using web Dynpro2.0.9. with Java.

But now also i am having the problem in down load the files.

In web Dynpro 2.0.9 "IWDResource" is not possible.

What is the alternative way to over come this problem.

I expect valuable suggestions from you.

Thanks in Advance,

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Hi,

please refer to the sample file upload/download code provided in the link below.

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/f5d3c40a-0801-0010-55b7-9e3...

Regards,

S.Divakar

Former Member
0 Kudos

Hi Divakar,

Thank u for ur reply.Now i am go through this link.I believe that surely it will help for me.Thank u.

Kind Regards,

S.V.Selva Bala.

Former Member
0 Kudos

Hi Bala,

I can't understand why you are converting the the bytes to String and then String to Bytes...

You can convert the image to bytes and store it in a binary attribute and map it to the other view through the controller and will be available in the second view.

In the wdDoInit() of the where you have the download element-

write the following code

IWDAtrributeInfo info=wdContext.getNodeInfo().getAttribute(<attribute name>);

IWDModifiableBinaryType binary=(IWDModifiableBinaryType)info.getModifiableSimpleType();

binary.setMimeType(WDWebResourceType.JPG_IMAGE);

Regards,

NOufal

Former Member
0 Kudos

Hi Noufal,

1.I have crated a attribute in binary data type.

2. Bind it to the FileDownload UIElement's data property.

3.From the database the image is selected as binary and set the value to the attribute.

4.while execute it i couldn't receive any image.

My requirement is load the client's photo from database table. Is has been stored as binary image in MS SQL server

Is it the right way?

how can I got the image at the screen?

Is any other UIElements available to solve it?

Kind Regards.

Selva Bala.

Former Member
0 Kudos

Hi SelvaBala,

You can try with the File URL to get the documents and Images.

Try to upload the photo using FTP and download it by using the URL of the file.

Kind Regards

Mukesh

Former Member
0 Kudos

You can create an http alias for the image and give the url as the source for the 'image' UI element.

Noufal

Answers (0)