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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.