Window.onload=function () {
Read the file and get the object that uploaded the file tag
var f1=document.queryselector ("#f1");
var f2=document.queryselector ("#f2");
var f3=document.queryselector ("#f3");
F1.onchange=function () {
var fl1=this.files[0];//get the uploaded file
var freader=new filereader ();//Read the file, create an object that reads the file
Freader.readastext (FL1);//Read file
Freader.onload=function () {//start reading the file loaded events
var Result=freader.result;
Console.log (result);
var sty=document.createelement ("style");
var head=document.queryselector ("Head");
Head.appendchild (sty). Innerhtml=result;
}
}
F2.onchange=function () {
var fl2=this.files[0];
var freader=new filereader ();
Freader.readastext (FL2);
Freader.onload=function () {
var Resultjs=freader.result;
var scr=document.createelement (' script ');
var odiv=document.queryselector ("div");
Odiv.appendchild (SCR). Innerhtml=resultjs;
Console.log (RESULTJS);
}
}
F3.onchange=function () {
var fl3=this.files[0];
var freader=new filereader ();
Freader.Readasdataurl(fl3);//Read pictures
Freader.onload=function () {
var Resultimg=freader.result;
var oimg=document.createelement (' img ');
var odiv=document.queryselector ("div");
Odiv.appendchild (OIMG);
oimg.src=resultimg;
Console.log (OIMG);
}
}
}
HTML5 uploading and reading of local files