欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

读取文件流 (包括图像) js file 对象 FileReader 对象 有大用 有大大用

<!-- oscar999  -->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

  <head>

  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <meta name="author" content="oscar999">

  <title></title>

  <script>

  function  handleFiles(files)

  {

    if(files.length)

    {

       var file = files[0];

       var reader = new FileReader();

       reader.onload = function()

       {

           document.getElementById("filecontent").innerHTML = this.result;

       };

       reader.readAsText(file);

    }

  }

  handleFiles(this.files);

  </script>

  

  </head>

  <body>


  <input type="file" id="file" onchange="handleFiles(this.files)" />

  <div id="filecontent"></div>

  </body>

</html>



来自 https://blog.csdn.net/weixin_46037781/article/details/118710615

https://www.codenong.com/8390855/

https://wenku.baidu.com/view/dbff8a4d0422192e453610661ed9ad51f11d5403.html?_wkts_=1692969054059&bdQuery=js+new+file%28%29%E5%8F%82%E6%95%B0

https://blog.csdn.net/Rotbing/article/details/55004833

https://www.qycn.com/xzx/article/15315.html

https://blog.csdn.net/commandboy/article/details/55680654





普通分类: