[nycphp-talk] how to prevent documents from download

Rob Marscher rmarscher at
Fri Aug 31 11:33:04 EDT 2007

> rgunj birgunj wrote:
>>  can any body tell me how to prevent documents from download using  
>> php.
On Aug 31, 2007, at 9:23 AM, Gary Mort wrote:
> You don't.
You can put them out of the docroot for your webserver... but then  
they won't be accessible at all through your site.  You can wrap the  
files in a php script that checks for credentials to make sure a user  
has access to the file, but, and I have to explain this to clients  
all the time, when someone views a file on the web, the file is  
*downloaded* to their computer for it to be viewed.  There's no way  
to get around this.  The user might have to figure out how to get it  
from their cache, but there's no way to let someone view a file  
without it being transfered to their computer and therefore it's not  
possible to keep a person from saving the file somewhere if they're  
smart enough.

More information about the talk mailing list