Local file access with JavaScript

前端 未结 13 2600
悲哀的现实
悲哀的现实 2020-11-21 04:07

Is there local file manipulation that\'s been done with JavaScript? I\'m looking for a solution that can be accomplished with no install footprint like requiring Adobe AIR.<

13条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-21 04:47

    If you have input field like

    
    

    You can get to file content in BLOB format:

    function add(event){
      var userFile = document.getElementById('file');
      userFile.src = URL.createObjectURL(event.target.files[0]);
      var data = userFile.src;
    }
    

提交回复
热议问题