0

I need to read XML content from a XML file to HTML.

HTML:

<input type="file" id="fileImport" name="fileImport" />

Javascript:

        $("#fileImport").change(function () {
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            var src = $("#fileImport").val();

            xmlhttp.open("GET", src, false);
            xmlhttp.send();
            xmlText = xmlhttp.response;
            alert(xmlText);
        });

But, for example, if the user selects the file c:/q/r/ff.xml I get C:\fakepath\ff.xml.

Cœur
  • 37,241
  • 25
  • 195
  • 267

0 Answers0