-4

We developing web sit.we have two textFiles in server http://192.168.3.134:8080/Helphands/forTest1.txt and http://192.168.3.134:8080/Helphands/forTest2.txt .We need is When we button click we need download forTest1.txt file and then count 1 write to forTest2.txt Please guide me . We are new this

We download like this

  </script>
        <a href="http://192.168.3.134:8080/Helphands/forTest1.txt" download>
  aaaa
</a>

now we need count number of download that as to be sent to forTest2.txt

Pavan Alapati
  • 267
  • 3
  • 5
  • 15

1 Answers1

0

you may want to create a javascript function on the onclick event of the link that allow the user to download the file and at the same time, update the counter on the second file. Below a simple counter of click on a link

<script type="text/javascript">

var clicks = 0;
function linkClick() {
    document.getElementById('clicked').value = ++clicks;
}

document.write('<a href="#" onclick="linkClick()">Click Me!</a>');

Then you just have to save that variable on the file (using a server side language)

Sim1
  • 534
  • 4
  • 24
  • yes exact .we need exact as you said Please guide me.We need download file .now we need update counter on the second file – Pavan Alapati Apr 20 '15 at 12:38