cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract the content of a user uploaded txt file in web dynpro?

Former Member
0 Kudos

Hi,

I'm working on a java web dynpro component. This component consists of document upload field, where users should be able to upload .txt documents. These uploaded text documents should then be somehow read, and thir content displayed. I am already able to upload documents using the upload field, and store it in the context, but I'm still not able to extract the content of these text documents for displaying.

Does anyone have any suggestions of how I could do this?

Any help will be greatly appreciated!

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

sanyev
Active Participant
0 Kudos

Hi Alain,

You can do through this document on how to upload/download files in Webdynpro.

[https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f]

Once you have the uploaded file in your context if you are storing it as a byte array then convert it to a string using the String constructor String(byte[] bytes) and then you can store this string in an attribute of type String which could be bound to a UI element (TextArea) to display the contents.

If you are using an IWDResource then you will get an inputstream from which you can read the data and convert it to a string for display as mentioned above.

Hope this helps.

Sanyev

Former Member
0 Kudos

Hi Sanyev,

Awesome, that's exactly what I needed!

Thanks a lot for your help

Answers (0)