$("input[type='file']").change(function() {
        var file = this.files[0];
        if (window.FileReader) {
          var reader = new FileReader();
          reader.readAsDataURL(file);
          //监听文件读取结束后事件    
          reader.onloadend = function(e) {
            console.log(e.target.result+"路径")
            $(".img").attr("src", e.target.result); //e.target.result就是最后的路径地址
          };
        }
      });

文章来自 https://blog.csdn.net/qq_33769914/article/details/54705820
参考 https://blog.csdn.net/qq_30100043/article/details/76408915

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2021-12-18
  • 2022-02-07
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2021-08-04
  • 2021-12-15
相关资源
相似解决方案