Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

image uploading and saving to database

hi ,

I am developing application for summer placement . i want to upload image with candidate's details and save it to database. How to do this? I hv got tutorials for uploading image but want to know how to save it to database table along with candidate's details.


Former Member
Former Member replied

Hi kavita,

In Webdynpro u r using attribute of type Resource ,which is binded to FileUpload UI element. From this attribute, u get file in Input stream format which can be converted into byte array like this

byte fileData[] = null;


InputStream fileIs = wdContext.currentFile().getFileData().read(false);

ByteArrayOutputStream bOut = new ByteArrayOutputStream();

int length;

byte[] part = new byte[10 * 1024];

while ((length = != -1) {

bOut.write(part, 0, length);



fileData = bOut.toByteArray();


} catch (Exception e) {



In webservice u can take a the byte array as input parameter where the uploaded file will be passed as byte array .

In DB u can store it as BLOB .

in case of any other doubt u can revert back to me.



0 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question