Skip to Content
0

How to upload image using odata services in sapui5

Jan 24, 2017 at 10:55 AM

354

avatar image

I want to upload image using js view and controller with odata services

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

VIPLOVE KHUSHALANI Jan 24, 2017 at 11:41 AM
0

Hi Kallesh ,

It depends on your backend upload service, what kind of data we need to POST.

On UI5 side you just check out this example : https://sapui5.netweaver.ondemand.com/sdk/explored.html#/sample/sap.m.sample.UploadCollection/preview

Just understand the different events of uploader like onChange you need to set headers of your post and on upload complete you need to refresh the model with new uploaded content

thanks

Viplove

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thank you sir...

0

Viplove Sir,

I tried lot but i am unable to solve image upload using odata service in sapui5. I am new to sapui5. If you have code related to image upload using odata services in sapui5 please send me.

Thanks

Kallesh KS

0

Hi Kallesh ,

If your backend service to upload the image is a form upload than you just need to call like below :

var oFileUploader = sap.ui.getCore().byId("<id of the file uploader>"); // or this,getView().byId(" <id of the file uploader>" )

oFileUploader.upload();

// this will automatically uploads you selected file in the file uploader control. in the file uploader you need to specify the upload url

And if you background service accepts bytes array string .. than you need to convert your image into byte array and than send them in the POST request.

thanks

Viplove

0