(function () { "use strict"; var configMap = { maxSize: 200000, inputName: 'user_avatar', acceptType: 'images/*' }; var inputFile; function init(opts) { inputFile = document.createElement('input'); inputFile.type = 'file'; inputFile.name =
(function () { "use strict"; var configMap = { maxSize: 200000, inputName: 'user_avatar', acceptType: 'images/*' }; var inputFile; function init(opts) { inputFile = document.createElement('input'); inputFile.type = 'file'; inputFile.name = opts.name || configMap.inputName; inputFile.style.display = 'none'; inputFile.accept = opts.acceptType || configMap.acceptType; document.body.appendChild(inputFile); } inputFile.onchange = function () { if (inputFile.files[0].size <= configMap.maxSize) { reader.readAsDataURL(inputFile.files[0]); } else { } }; var reader = new FileReader(); reader.onload = function () { // reader.result }; })();