0

i was trying to write a code using html and javascript -when i enter local folder name it must show all the saved images in that local folder or local directory.

I have written a code but it shows only the contained image file names of that local folder. for e.g. if i enter folder name 012 it is listing all the images in it like 2.jpg (etc).

But i want all the images in that folder to display straightaway.if there are 2 images in the folder it should display that, if there are 3 images in the folder, it should display all 3 images.

    <head><title>my project</title>
    <script>
    function myFunction()
     {
     var x = document.getElementById("demo").value;
     x = escape(x);
    window.location.href = "C:/Users/gupta/Documents/"+ x;
    return false;
    }

    </script>
    </head>
    <body>
    <form id="test" method="get"  onsubmit="return myFunction();">
    userid
    <input type="text" name="userid" id="demo">
    <br>
    <input type="submit" value="submit" id="btn">
    </form>
    </body>
    </html>
`````````````````````````````````

Michael Nelles
  • 5,426
  • 8
  • 41
  • 57
  • `escape()` has been deprecated, use [`encodeURI()`](https://www.w3schools.com/jsref/jsref_encodeuri.asp) instead. – Daemon Beast Feb 08 '20 at 16:31
  • Reading or writing arbitrary files in browser is not allowed by design (see https://stackoverflow.com/a/372333/2358409) – uminder Feb 08 '20 at 16:31

0 Answers0