Page 1 of 1
network drive
Posted: Thu Oct 26, 2006 1:40 pm
by Regit
I have a mapped network drive (S) and im wanting to read in data from a file on this drive how can I do this with php? can i change directory to this mapped drive??? please help
Posted: Thu Oct 26, 2006 1:41 pm
by tbrown1
Alright I am changing this answer because a post below this one reminded me of something whatever user the web server is running as will not have a drive mapped as s: currently so you will need to use the UNC mapping (ie:/somecomputer/somefolder/) for the drive and then that user must have access to that drive.
Posted: Thu Oct 26, 2006 3:15 pm
by Ollie Saunders
Code: Select all
$file = file_get_contents('S:/dir/file.txt');
No?
Posted: Thu Oct 26, 2006 3:19 pm
by Burrito
no.
mapped drives are profile-specific.
Posted: Thu Oct 26, 2006 3:39 pm
by Ollie Saunders
Can't you mount it automatically via cmd? Which you could run with backtick.
Posted: Thu Oct 26, 2006 3:51 pm
by Burrito
for which user?
Posted: Thu Oct 26, 2006 5:15 pm
by printf
Any IO function that PHP supports is hooked into all mapped or network drives that have open access to the share. If you need to support login via a share then PHP can not access the network drive, you will have to access it using COM via PHP!
For mapped or network drives all you do is supply the Network Indentification followd by the SHARE name and then the path an file name or directory you want to read!
Network Indentification is the computer name that contains the mapped drive or share...
Share is the common name of the mapped drive or directory being shared on some dive....
So, file get contents
echo file_get_contents ( '//Network Indentification/Share/file.txt' );
Say the computer name is
my_network, the Share is
my_folder, my_folder points to drive
F:, now say I want access all the files that are in my_folder, but in sub-folder called
images, so I would...
Code: Select all
<?php
$files = glob ( '//my_network/my_folder/images/*' );
print_r ( $files );
?>
a mapped drive is just like using symbolic links on Unix or Linux, where the mapping can be local or across the world!
printf