j-FileReader
- singleton
- Pouze pro textové soubory
Metody:
component.open(opt)- otevřít souborový prohlížečopt.multiple {Boolean}umožňuje více souborů (podle předvolby:false)opt.accept {String}umožňuje pouze specifikovaný typ obsahu (předvolený:undefined)opt.base64 {Boolean}čte soubor v kódování Base64 (podle předvolby:false)- NEW:
opt.files {HTTP Files}čte soubory např. z Drag & Drop opt.callback {Function(file)}a callback- NEW:
opt.progress {Function(percentage, file)}volitelné
var opt = {};
opt.accept = 'text/*';
// opt.files = e.files;
opt.callback = function(file) {
console.log(file);
};
SETTER('filereader/open', opt);Použijte ji s <ui-component name="filereader">Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy DEF.fallback a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.
<ui-component name="filereader"></ui-component>
<a href="javascript:fopen()">OPEN FILE</a>
<script>
function fopen() {
var opt = {};
opt.accept = 'text/*';
opt.callback = function(file) {
$(document.body).append('<div><pre><code>{0}</code></pre></div>'.format(JSON.stringify(file, null, ' ').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"')));
};
SETTER('filereader/open', opt);
}
</script>