2018-09-26
<!DOCTYPE html> <html> <head> <meta charset="{CHARSET}"> <title></title> </head> <body> <input type="file" name="" id="inputs" value="" /> <div id="dd"></div> <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script> <script type="text/javascript"> $('#inputs').change(function(){ var fil = this.files; console.log(fil.length) for(var i=0;i<fil.length;i++){ console.log(fil[i]) console.log(11111111111111111111111111111111111) reads(fil[i]) } }) function reads(fil){ var reader = new FileReader; reader.readAsDataURL(fil); reader.onload = function(){ $('#inputs').after("<img src='"+reader.result+"'>"); console.log(reader.result) } } </script> </body> </html>