<!DOCTYPE HTML><HTMLLang= "en"><Head> <MetaCharSet= "UTF-8"> <Metaname= "Viewport"content= "Width=device-width, User-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <Metahttp-equiv= "X-ua-compatible"content= "Ie=edge"> <title>Document</title></Head><Body><ButtonID= "BTN"onclick= "Openbrowse ()">Uploading files</Button><inputtype= "File"ID= "File"style= "Display:none"><Script> functionOpenbrowse () {varIE=Navigator.appname== "Microsoft Internet Explorer" ? true : false; if(IE) {document.getElementById ("file"). Click ();//document.getElementById ("filename"). Value = document.getElementById ("file"). Value; } Else { vara=Document.createevent ("mouseevents");//Processing of FFA.initevent ("Click", true, true); document.getElementById ("file"). Dispatchevent (a); } } (functionHandlefiles () {varVMS= This; varFileInput=Document.queryselector ('#file'); Fileinput.onchange= function () { varfile= This. files[0]; varFile_typename=file.name.substring (File.name.lastIndexOf ('.') + 1, file.name.length); if(File_typename!='mp3') {alert ('please upload MP3 file'); return} vm.mp3filename=File.name; varReader= NewFileReader (); Reader.readasdataurl (file); Reader.onload= function() {Console.log (Reader.result)}; } })()</Script></Body></HTML>
Upload file to base64 format