美文网首页
^_^ 关于input file文件上传相同文件时不识别的方法

^_^ 关于input file文件上传相同文件时不识别的方法

作者: 風隨風去 | 来源:发表于2017-09-20 23:41 被阅读0次
<input accept="image/*" multiple="multiple" id="file" style="display:none" type="file" />//如果是模拟的则需display:none
$scope.file = document.getElementById("file");
$scope.file.click();//点击模拟的上传时自动添加点击
$scope.file.onchange = function () {
      var reader = new FileReader();
      reader.onload = function (evt) {
        var imgUrl:any = evt.target;
        var base64 = imgUrl.result;//获取的编译的文件路径
        $scope.file.outerHTML=$scope.file.outerHTML;//处理相同的文件不改变
      };
      reader.readAsDataURL($scope.file.files[0]);
};

相关文章

网友评论

      本文标题:^_^ 关于input file文件上传相同文件时不识别的方法

      本文链接:https://www.haomeiwen.com/subject/jpeohxtx.html