Hello, everyone. I've been working on html5 file reader, to read local text files, but I've searched a lot of answers. I can't figure out where to write the text path.

this is a page I found from the Internet. I probably modified it a little bit, but there was no response after clicking the import button. Is there something wrong with the code, or this path is not written, but I can"t find a place to write. Please know how to give me some advice. Thank you!

<!DOCTYPE html>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UFT-8">

<script src="jquery-1.8.2.js" ></script>
<script src="FileSaver.js" charset="utf-8"></script>
</head>
<body >


<div>
 <div>
<input type="file" id="files" style="display:none" onchange="fileimport();"/>
<input type="button" id="import" value=""/>

        <input type="button" id="export" value=""/>
     </div>
</div>
<script>
var txtdata;
function fileimport()
{
    var selectedFile = document.getElementById("files").files[0];//File
    var name = selectedFile.name;//
    var size = selectedFile.size;//
    console.log(":"+name+":"+size);


    var reader = new FileReader();//
    reader.readAsText(selectedFile,"gb2312");//


    reader.onload = function(){
        console.log(this.result);//result
$("
" + this.result + "
"). AppendTo ("body"); Txtdata = this.result; }; } $(document) .ready (function () { / / alert ("start"); Click (function () {/ / Click the import button to make files trigger the click event, and then finish reading the file. $("- sharpfiles"). Click (); }); $("- sharpexport") .click (function () { Var content = "this is exported directly using HTML5:" + txtdata; Var blob = new Blob ([content], {type: "text/plain;charset=utf-8"}); SaveAs (blob, "file.txt"); / / saveAs (blob,filename) / / only in the download directory of chorme / / alert ("export OK") }); }) < / script > < / body > < / html >
Mar.03,2021

your code I run locally imports can be imported but sometimes garbled. I just quote a jq library locally

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf46be-31672.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf46be-31672.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?