Reply to deny direct access to a single folder with .htaccess

Your name:

Reply:


Posted by psion on 11/19/87 11:45

Hello,
I have not found a clear way of doing what I want and resort to posting
my question.

I have a php file that will link to pdf files from a directory called
pdf (within the apache htdocs folder). The way I have it coded now, the
address to the pdf shows in the address bar, and a user can modify just
the file name to read other files, which is something I don't want.
I am trying to deny access to this pdf directory to anyone except the
localhost, so that changing the file name will not allow viewing it. Is
this the proper way I should go about resolving the matter?
Is there a better way?

Thank you,
psion

P.S. I have tried what I think would be best, which is to display a pdf
file by "printing" it with the php file, ie:

$file_contents = file_get_contents('$filename');
header('Content-type: application/pdf');
print $file_contents;

but I get an error, stating that the pdf file can't be displayed
because it may be corrupt, and it isn't. Was anyone successful in doing
something like this?

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация