I am trying to process an XML file using Javascript.
xhttp.open("GET","exportproject.xml",false);
What I want to do is, let the user specify the file (instead of hard-coding it to exportproject.xml) using file uploader and then process the same using Javascript instead of sending it to the server.
Is it possible?
I am trying to process an XML file using Javascript.
xhttp.open("GET","exportproject.xml",false);
What I want to do is, let the user specify the file (instead of hard-coding it to exportproject.xml) using file uploader and then process the same using Javascript instead of sending it to the server.
Is it possible?
Share Improve this question edited Oct 12, 2021 at 21:34 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Apr 26, 2012 at 6:44 user1044209user1044209 951 silver badge6 bronze badges3 Answers
Reset to default 8You may want to take a look at the HTML5 FileReader API - http://www.html5rocks./en/tutorials/file/dndfiles/
If you don't mind a solution that requires a modern browser (basically, ie 9+) you can use the html5 file API with a basic <input type="file">
.
Take a look at this link, there are a number of excellent examples to get you started.
Javascript cannot read a file from the client machine (where the browser runs). That would be a security violation. You will have to submit the file to server and process it.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744343717a4569558.html
评论列表(0条)