How to process uploaded file using Javascript - Stack Overflow

I am trying to process an XML file using Javascript.xhttp.open("GET","exportproject.xml

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 badges
Add a ment  | 

3 Answers 3

Reset to default 8

You 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

相关推荐

  • How to process uploaded file using Javascript - Stack Overflow

    I am trying to process an XML file using Javascript.xhttp.open("GET","exportproject.xml

    7天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信