-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathtextReader.html
47 lines (39 loc) · 1.17 KB
/
textReader.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Text Reader Test</title>
<script id="sap-ui-bootstrap"
src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js"
type="text/javascript"
data-sap-ui-theme="sap_goldreflection"
data-sap-ui-libs="sap.ui.commons"
>
</script>
<script type="text/javascript">
var oTextView = new sap.ui.commons.TextView('txtContent').placeAt("target1");
var _handleFileSelect = function(evt){
var file = evt.target.files[0];
if (file) {
var reader = new FileReader();
// On load set file contents to text view
reader.onload = (function(theFile) {
return function(evt) {
oTv = sap.ui.getCore().byId('txtContent');
oTv.setText(evt.target.result);
};
})(file);
// Read in the file as text
reader.readAsText(file);
};
};
jQuery(function() {
jQuery.sap.byId("txtFile").bind('change', _handleFileSelect );
});
</script>
</head>
<body class="sapUiBody" role="application">
<input type="file" id="txtFile" />
<div id="target1"></div>
</body>
</html>