Open windows explorer using PHP and / or JS

1

Good morning, everyone.

It is possible to open Windows Explorer in the client workstation in a certain network folder (windows share) either with PHP itself and / or JS.

I have tried with the php exec () and window.open (faithful: ///) from JS, but without success.

The application is running on linux on the same network as client stations.

    
asked by anonymous 26.05.2017 / 17:09

2 answers

3
  

Is it possible to open Windows Explorer using PHP?

No! PHP is a language that runs on server-side; In a general context you will not be able to interact with native resources on the client-side, that is, in the user's browser;

  

Is it possible to open Windows Explorer using Javascript?

Using Internet Explorer (this is probably not possible with other browsers), you can use some ActiveX features, but I only tried doing this with HTML saved on the machine itself; Using something like:

<script type="text/javascript">
   window.open("nomeDoArquivo.html", "NomeDaNovaJanela");
</script>

I do not know the context to which you need to use this solution, but from the security point of view this is not advisable; In addition to the fact that most browsers do not allow actions like this, you will face several restrictions with anti-virus software that consider such actions as a threat;

I recommend thinking of another approach to solving your problem; Handling directories on the client does not seem to be an approach to Web-based solutions, for the simple fact that you can not guarantee that a particular directory exists on the client;

    
26.05.2017 / 18:43
1

It's all about JavaScript and ActiveX.

<script type="text/javascript">
        function abrirPrograma()
        {
            var shell = new ActiveXObject("WScript.Shell");
            var fileLeft = "\"D:\Caminho\para\o\arquivo\"";
            var fileRight= "\"D:\Caminho\para\o\arquivo2\"";
            shell.Run(fileLeft + " " + fileRight);
        }
        </script>

To open it uses a link / button / etc ... specifying the function:

<a href="abrirPrograma()">Abrir Programa</a>
    
26.05.2017 / 17:45