I have a csv file that is written on by a form on the site, and I would like to protect it, allowing its download only to one, or two users.
Is it possible, how?
If you save it above the public part of the hosting account then only those with access to the hosting account itself will be able to access it.
If you want it to be available from the web for specific members then you will need to set up some form of member’s area that only they will have a login to and make the file available only via that.
I think first option is out, as have access to public_html, but not above it (Globat hosting), and the actual domain is a directory of that - main account associated with domain-one, and the site (domain-two) I am working on is in a directory named domain-two.
I set up a simple login in a directory, and I was able with some trials to get the csv writable in that directory:.
domain-two/protected-dir
Login system works fine, but the csv file is still accessible as direct download:
domain-two/protected-dir/file.csv
I put a .htaccess file in the domain-two directory, and .htpasswd in the protected, I did a test and it worked fine.
I decided to change the name of the protected-dir, and now when I try to access domain-two it asks for password, and when clicking cancel it either keeps asking for the password, or returns this:
Authorization Required
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn’t understand how to supply the credentials required.