0
Anyone can please help in this. I need to assign a path for a text file in a variable to be shown later on in html here's my code:

<html>

<head>   
</head>

<body>

<!-- Header -->
<header>
</header>
<!-- End Header -->


<!-- Main -->
<section id="main">


     <script type="text/javascript">

        var reader = new FileReader();

        function readText(that){

            if(that.files && that.files[0]){
                var reader = new FileReader();
                reader.onload = function (e) {  
                    var output='myFile.txt'; // Here's the variable I want to assign my path in         

                document.getElementById('text').innerHTML= output;
                };//end onload()
                reader.readAsText(that.files[0]);
        } 
</script>

        <!-- Cols -->
        <div class="cols">
            <h2>Contact Us</h2>
            <!-- Col -->

                  <div id="text"></div>

            <!-- End Col -->

        <!-- End Cols -->
        </div>

</section>
<!-- End Main -->

</body>
</html>
4
Contributors
7
Replies
8
Views
4 Years
Discussion Span
Last Post by AleMonteiro
0

are you asking for storing the file to a new path or its original path?

i am getiing little bit confusion on your question

pls clarify me so that i will help you soon

0

sorry for being late.
I want to save a text file path in the js variable so i can retrieve it later inside my html.
I want to retrieve the text inside a file that is uploaded on my server also but so when someone needs to edit the text to go inside the file edit and save it and the changes he did to be applied in the website.
Any help?

0

If your question is resolved, please set the post as Solved and also mark the answers that was helpfull to you.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.