How do I make a file download require a username and password

In a basic HTML web page, how do you make the user have to enter a username and password before they are allowed to download a file?

What is the best way of achieving this on a website, preferably in plain HTML?

Answers


You won't be able to do this with plain HTML. Easiest way is probably to place the protected file in a directory protected by an .htaccess and .htpasswd file.


This can't be achieved in HTML.

With client side technologies, the best you are likely to be able to achieve is a JavaScript prompt that you use the data from to direct people to a secret URI.

This is something that really should be handled by the web server.


I agree with David...this can't really be done. Putting up a JavaScript prompt only protects you so far as well...that isn't really secure.

If you are on an Apache server, you could setup a .htaccess file and setup some user authorization options that point at a page which has the link to your download file. A simple implementation would give you 1 user/password combo that you could distribute to your users. The Apache documentation for this may be found here. Unfortunately I'm not really familiar with how IIS handles this sort of thing.

If you don't want to distribute a generic username/password combo to your users, you're pretty much going to be stuck creating a (or making use of an exsitng) user-management system. There are quite a few modules strewn throughout the web, and a simple Google search should bring you to quite a number of tutorials or existing implementations, depending on what you require.


first download phpmyadmin.open the file.click on create login.name it as login.php.then create a new want again name file.php.after you click yes it popout a logon information.enter the usrname you want and password you want

hope this help!


Need Your Help

Pick an image and resize to 72x72

android bitmap

I picked an image from gallery and decoded it. Now I just want to resize that bitmap to standard 72x72 size in order to use as an profile photo.

Aligning words without delimiters?

vim alignment tabular

I'm trying to align words with vim-tabular, but without delimiters between them, like commas or colons. For instance: