1

Does php allow you to check if a network drive is mapped. Essentially on all computers our G:\ drive is mapped. Is it possible using php script to check if the G:\ drive is mapped? In order to access directories and files from the mapped drive I use UNC names.

Help much appreciated

David Egan
  • 424
  • 2
  • 8
  • 23
  • Try checking this out: http://stackoverflow.com/questions/2592910/mapped-network-drives – Audite Marlow Nov 11 '15 at 09:21
  • You need to run PHP on all the specific computers though. – moorscode Nov 11 '15 at 09:33
  • Hope you have not any plan to create a application and use it on client browser and check that network drive is there configured on client PC or not. Then surely you will not be able to do that for security reason. – Partha Sarathi Ghosh Nov 11 '15 at 09:57
  • Perhaps something I forgot to include. php is running under xampp on the server. Xampp is also running as a service. So mapped drives are not accessible using php functions while xampp is running as a service. I have tried all of the above but to no avail. Is there any other way around this? – David Egan Nov 11 '15 at 13:03

1 Answers1

0

Why should you use php to access to a client path? file_exists should work as well but i don't understand the point :)

<?php
$mydir = "G:\ ";

echo file_exists($mydir) ? "G is mounted":"G is not mounted";
?>
RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Roberto
  • 1
  • 3
  • Does not actually work unfortunately, but if you add a folder name after the drive letter it does like `$mydir = "G:\data$ ";` – RiggsFolly Nov 11 '15 at 09:39
  • Perhaps something I forgot to include. php is running under xampp on the server. Xampp is also running as a service. So mapped drives are not accessible using php functions while xampp is running as a service. I have tried all of the above but to no avail. Is there any other way around this? – David Egan Nov 11 '15 at 13:03
  • David have you considered to use Javascript? :D – Roberto Nov 11 '15 at 19:27
  • seriously the only way is install a service client side that answer for example via ssh or on a specific port, do the check and send the result to a php page or another service on the server – Roberto Nov 11 '15 at 19:49