Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pointing to a different drive

Status
Not open for further replies.

Eyespi20

Technical User
Jan 14, 2004
296
US
I have a web page that has links to various PDF files on the page. The PDF files live on the same server with the web page, but unless the user is inside the network, the files will not come up.

If it would at least ask for a login and password, I could handle this as the files are really only supposed to be for our employees, but it doesn't even do that it gives a page not found error.

Can anyone help me figure out how to work around this? The drive that the html files are on is not big enough to hold all the pdfs' and my network admin guy won't let me move the html files and iis.

Thanks

Margaret
 
Margret,

Like Dan says - virtual directory is one way.

Another would be a server side script. I use PHP - if your server interprets PHP, then this would be applicable (this is actually not the right forum to be postinf PHP, but here we go).

download_pdf.php
Code:
<?php

function download_pdf($file_name) {
  $path = "c:\\".$file_name;
  header("Content-type: application/pdf");
  header("Content-Disposition: attachment; filename=$file_name");
  readfile($path);
}

$pdf = $_REQUEST["pdf"];	

download_pdf($pdf);

?>

Place this file in the web server directory (name it download_pdf.php).

This example assumes that the pdf's are in the root of the C drive - modify to your need.

To link to a pdf on the drive, do this:
Code:
<a href="download_pdf.php?pdf=my_pdf_file.pdf">my_pdf_file.pdf</a>

Regards
 
<a href="download_pdf.php?pdf=my_pdf_file.pdf">my_pdf_file.pdf</a>

Correct me if I am wrong because I don't do PHP, but is your script not giving someone full access to the C drive? Even if this is just an example, you should mention such a massive security risk if the script is used "out of the box" like you are suggesting.

Hope this helps

Wullie

Fresh Look - Quality Coldfusion 7/Windows Hosting
YetiHost - Coming Soon

The pessimist complains about the wind. The optimist expects it to change. The leader adjusts the sails. - John Maxwell
 
Depending on the security of the server that script might not work. Most of the time in php you are limited to your domain folder and the c:\temp folder (for file uploading) but that's it.

NATE


mainframe.gif


Got a question? Search G O O G L E first.
 
Hi all -- lovely suggestions everyone.

My network guy says he created the virtual directory, but still no success on my end connecting to those files.

Some of the files are not pdf, so I'm not sure the php solution is the way to go, but it may be on the right track. I will have to check it out to see if I can at least get them the pdf's as those are more prevalent and probably the most useful. There are a few short videos and some excel spreadsheet files that are useful to the techs as well as the pdf's.

Thank you all

Margaret
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top