cancel
Showing results for 
Search instead for 
Did you mean: 

oData image upload

0 Kudos
1,303

Hi experts.......

I am new for this sapui5 .......

Actually i am doing one image uploading by using odata .  I converted the image and keeping ready but how to post that image to back end i dont know if u guys know this plz help me............

This is my coding..

     var oModel = this.oView.getModel();

  

   var button = this.getView().byId("upload");
  
     var upload = this.getView().byId("fileUploader");
  
       var oDialog = new sap.m.Dialog ({contentWidth:"70px"});
   // oDialog.open();

        var file = jQuery.sap.domById(upload.getId() + "-fu").files[0];

  if(file===undefined)return;

  
     var BASE64_MARKER = 'data:' + file.type + ';base64,';

 

 

        var filename = file.name;

        var reader = new FileReader();

  // On load set file contents to text view

        reader.onload = (function(theFile) {

        return function(evt) {

        oModel.oData.personal[0].base64 = evt.target.result.indexOf(BASE64_MARKER) + BASE64_MARKER.length;

        oModel.oData.personal[0].base64Index = evt.target.result.substring(oModel.oData.personal[0].base64Index);

Thank you

Regards..

Damian.a

View Entire Topic
santhu_gowdaz
Active Contributor
0 Kudos

Hope these links will solves your issue,

Upload Image in UI5 · GitHub