How do I open a window, like windows explorer, from a website

I am developing a website that will work with images. The images are in the micro location. I want to take all the images (are +- 10 images) that are in a folder and put them in a grid. To then allow it to be given a zoon. I'm finding that by java script I can do this.

To be understood better, today with the program running on Windows, I call, from the program, Windows explorer pointing to the folder with the images.

Author: Tmc, 2017-09-27

1 answers

You can use a simple input of type file

See this example

Html:

<form id="post-form" class="post-form" method="post">
    <label for="files">Select multiple files: </label>
    <input id="files" type="file" multiple/>
    <output id="result" />
</form>

Javascript:

window.onload = function(){
    //Check File API support
    if(window.File && window.FileList && window.FileReader)
    {
        var filesInput = document.getElementById("files");
        filesInput.addEventListener("change", function(event){
            var files = event.target.files; //FileList object
            var output = document.getElementById("result");
            for(var i = 0; i< files.length; i++)
            {
                var file = files[i];
                //Only pics
                if(!file.type.match('image'))
                    continue;
                var picReader = new FileReader();
                picReader.addEventListener("load",function(event){
                    var picFile = event.target;
                    var div = document.createElement("div");
                    div.innerHTML = "<img class='thumbnail' src='" + picFile.result + "'" +
                    "title='" + picFile.name + "'/>";
                    output.insertBefore(div,null);
                });
                //Read the image
                picReader.readAsDataURL(file);
            }
        });
    }
    else
    {
        console.log("Your browser does not support File API");
    }
}

Css:

body{
font-family: 'Segoe UI';
font-size: 12pt;
}

header h1{
font-size:12pt;
color: #fff;
background-color: #1BA1E2;
padding: 20px;

}
article
{
width: 80%;
margin:auto;
margin-top:10px;
}

.thumbnail{

height: 100px;
margin: 10px;
}

Result: http://jsfiddle.net/0GiS0/Yvgc2 /

Source: https://stackoverflow.com/questions/20779983/multiple-image-upload-and-preview

 2
Author: Wictor Chaves, 2017-09-27 17:14:20