0

I am working on a php code as shown below in which I am making a connection to network drive using credentials.

Php code:

$user = 'mickeymouse';

$password = 'helloworld';

exec('net use "\\\INVEST-ST-001\Video_Remap\podcast\" /user:"'.$user.'" "'.$password.'" /persistent:no');    // Access a network drive using credentials

$src_dir = ('\\\INVEST-ST-001\Video_Remap\podcast\incoming_folder'); 

$destination_dir = ('\\\INVEST-ST-001\Video_Remap\podcast\outgoing_folder');

exec('net use "\\\INVEST-ST-001\Video_Remap\podcast" /delete /yes');                                     // Then deleting it

$mp4_files = preg_grep('~\.(mp4)$~', scandir($src_dir)); // Line D                                    


I also made a connection through net use command:

net use "\\INVEST-ST-001\Video_Remap\podcast" /user:"mickeymouse" "helloworld" /persistent:no

and I got the following message:

The command completed successfully


The version of php which I am using is:

PHP version: 5.3.28


Error:

The error which I am getting on the webpage is:

The system cannot find the path specified. (code: 3) in W:\ahdhd\shshshs\status.php on Line D in the php code above.


Problem Statement:

I am wondering what changes I should make in the php code above or any other net use command I need to use in order to make a connection to network drive using credentials in php.

Edited:

I am able to access everything inside test directory but not inside Audio_Remap directory.

enter image description here

flash
  • 1,455
  • 11
  • 61
  • 132
  • Have you tried checking the occurences of backslashes? To me it looks like you have too many of them inside your `exec` call – Nico Haase Jun 27 '19 at 13:49
  • @NicoHaase Thanks for checking. It was working before. As soon as I restarted the server everything stopped before. – flash Jun 27 '19 at 14:06
  • @NicoHaase I will share more information. – flash Jun 27 '19 at 14:10
  • @NicoHaase I am able to access everything inside **test** directory but not inside **Audio_Remap**. Inside **test** directory I don't need any kind of credentials. – flash Jun 27 '19 at 14:14

0 Answers0