blackcell Posted January 21, 2008 Share Posted January 21, 2008 I am trying to figure out how to read a pdf from a directory on my file server which is different than my web server. I can upload pdfs to the file server no problem, but when it comes to reading it back on request, nothing is working. I don't know if it is a security measure or what. Writing: <?php copy("incoming/123.pdf","//server001/public/123.pdf") ?> And it works. Like a charm. Attempt at reading: <?php <a href="//server001/public/123.pdf">[Open]</a> ?> Any pushes in the right direction? Quote Link to comment https://forums.phpfreaks.com/topic/87115-solved-reading-from-pc-other-than-web-server/ Share on other sites More sharing options...
cooldude832 Posted January 21, 2008 Share Posted January 21, 2008 html reference to files must follow a logically global path using an internal reference will not work because the file is being executed on the remote machinen using only the info it knows (The www file paths so to speak of). so saying <?php echo "<a href=\"".$_SERVER['DOCUMENT_ROOT']."/index.php\">index.php</a>"; //That above fails as its internal echo "<a href=\"http://www.mysite.com/index.php\">index.php</a>"; //This works $data = copy($_SERVER['DOCUMENT_ROOT']."/index.php"); ///Will always work $data = copy("http://www.mysite.com/index.php"); //Might not always work as you are using a global reference ?> Some php file operations only work on internal files in the last case it would attempt to copy a global file, most likely failing or getting the outputting html content of it Quote Link to comment https://forums.phpfreaks.com/topic/87115-solved-reading-from-pc-other-than-web-server/#findComment-445539 Share on other sites More sharing options...
blackcell Posted January 22, 2008 Author Share Posted January 22, 2008 So now I have XAMPP on server001 and I am hosting XAMPP on server002 via mapped drive X:/xampp. I have a directory on server001 named public with letter P:/ and I am attempting to open from P:/ and still not working. Is server001 considered to be the 'local' machine although the xampp directory is on server002? I thought this would work but I am running into the same error. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/87115-solved-reading-from-pc-other-than-web-server/#findComment-446167 Share on other sites More sharing options...
blackcell Posted January 22, 2008 Author Share Posted January 22, 2008 Sorry I found a way around it. I was going way out of the way... Quote Link to comment https://forums.phpfreaks.com/topic/87115-solved-reading-from-pc-other-than-web-server/#findComment-446172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.