Veer Shrivastav
Veer Shrivastav

Reputation: 5496

Php - Secure File Download Facility

I want to make a website, which only allows authentic users to download files from the browser. And any one else cannot download the file.

I have uplaoded the files with 000 access, which will restrict the users, but how to give permissions only to authentic users.?

Can anyone help me with it?

Upvotes: 1

Views: 211

Answers (1)

Nik Terentyev
Nik Terentyev

Reputation: 2310

You don't need to give a link to physical folder of a file. You may emulate it with such code(example of png):

header("Content-Type: application/octet-stream; ");
header("Content-Transfer-Encoding: binary"); 
header('Content-Disposition: attachment; filename="name.png"');
readfile($fileaddress);

Upvotes: 1

Related Questions