Wednesday, 15 January 2014

Access Files from different domains using php -



Access Files from different domains using php -

i have pdf documents stored in shared folder in server need access them web application through file browsing. know names of files stored there. link (file:\\server\folder\abc.pdf).

my php application in web server running on xampp. shared folder in different domain. (not in web server folder - normal file folder). when seek access file says "cannot find file:\\server\folder\abc.pdf. create sure path or net address correct".

<a href="file:\\server\folder\abc.pdf" >load file</a> <?php echo $dir = '\\\\server\\folder\\'; $dh = opendir($dir); while (($file = readdir($dh)) !== false) { echo "<a href=".$dir.$file.">".$file."<br></a>"; } closedir($dh); ?>

when type "\\server\folder" on address bar prompts username , password of folder since in different domain (my current domain authenticated on sign on). when provide windows authentication folder, web application url work , opens file successfully.

i want accomplish task without prompting directory security username , password. web application used many users locally mapping of network drive not feasible.

can help me on please?

got answer

we can map network drive server , save username , password prompted in "map network drive" wizard , can utilize mapped network wizard normally.

below code worked me.

$dir = "a:/folder/"; $dh = opendir($dir); while (($file = readdir($dh)) !== false) { echo 'the file : ' . $file . "\n"; } closedir($dh);

php file cross-domain opendir network-share

No comments:

Post a Comment