Jump to content

Recommended Posts

Helo,

I have a file i don't want unauthorised users to access. I created a login to the page restricting access, but if one knows the name of the file and type it on the browser the file loads and subsiquently can be accessed and downloaded. eg www.mysite.com/user/getfile/file.exe

 

the file to be protected is the file.exe and its located on the get file page which you can access only if you have a valid username and password. but if typed the address as shown above file is downloaded.

 

how do i restrict access to this file?  please and thanks

Link to comment
https://forums.phpfreaks.com/topic/133633-secure-file/
Share on other sites

A few options:

 

Hide the link by forcing a download dialog using PHP headers.

 

http://uk.php.net/header

 

Store the file as a BLOB (MySQL) in the database and output via headers

 

http://dev.mysql.com/doc/refman/5.0/en/blob.html

 

setup a .htaccess file (for Apache server) on that specific file so that the user cannot access it directly withouth being prompted for a password.

 

http://httpd.apache.org/docs/1.3/howto/htaccess.html

 

 

Link to comment
https://forums.phpfreaks.com/topic/133633-secure-file/#findComment-695225
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.