Quantcast
Channel: SCN : Discussion List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 6412

How to use this script in sapui5 page view

$
0
0

Hi Experts,

 

  I am converting an image into base64 and upload it. i got one method in java script so it works in sapui5 ( index.HTML ) i want to use that function in the page view whether is it possible to use or any idea for that.

 

CODE:

 

</head>
<div>

    <div>

       <label for="filePicker">Choose or drag a file:</label><br>

        <input type="file" id="filePicker">

    </div>

    <br>

    <div>

        <h1>Base64 encoded version</h1>

        <textarea id="base64textarea" placeholder="Base64 will appear here" cols="50" rows="15"></textarea>

    </div>

</div>

<style>

<!--

.canvas{position: absolute;width: 50%;height: 50%;}

-->

</style>

<script >

function give(){

alert("hi");

var Cvr;

var handleFileSelect = function(evt) {

    var files = evt.target.files;

    var file = files[0];

    if (files && file) {

        var reader = new FileReader();

        reader.onload = function(readerEvt) {

            binaryString = readerEvt.target.result;

          Cvr= document.getElementById("base64textarea").value = btoa(binaryString);

            alert(Cvr);

        };

        reader.readAsBinaryString(file);

    }};

 

if (window.File && window.FileReader && window.FileList && window.Blob) {

    document.getElementById('filePicker').addEventListener('change', handleFileSelect, false);

} else {

    alert('The File APIs are not fully supported in this browser.');

}}

</script>


Viewing all articles
Browse latest Browse all 6412

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>