on 01-24-2017 10:55 AM
I want to upload image using js view and controller with odata services
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/previe...
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.