Jump to content

[SOLVED] Reading from pc other than web server


blackcell

Recommended Posts

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?

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.