pk27 pk27 - 4 years ago 124
PHP Question

PHP- How to create a text file in network shared folder

Can someone pls help me on how to create a text file in network shared folder. The shared folder has username and password.
Many thanks!
here my code

<?php
system('net use \\192.168.*.*\folder$ password/user:username');
$dir = "\\192.168.*.*\folder$";
if (is_dir($dir))
{
if ($dh = opendir($dir))
print "able to access directory tree.";
}
else { print "not access tree.";}
?>

Answer Source

Found that php somehow couldn't read folder$ (hidden folder). Removed $ (made it visible) and worked.

<?php
//system('net use \\192.168.*.*\folder$ password/user:username');
$dir = "\\\\192.168.*.*\\folder";
if (is_dir($dir)) 
{
    if ($dh = opendir($dir))        
        print "able to access directory tree.";       
}
else {   print "not access tree.";}
?>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download