Hide download URL in PHP
-
Hi, I have policies to documents and I want to put it on a web PHP portal for download to the employee with a password protected access. If the URL for a policy is www.myWeb.com/policies/document1.pdf, I don't want any one to see this url when downloading or when viewing the page source. What's the best way to do it? Thanks, Jassim[^]
Technology News @ www.JassimRahma.com
-
Hi, I have policies to documents and I want to put it on a web PHP portal for download to the employee with a password protected access. If the URL for a policy is www.myWeb.com/policies/document1.pdf, I don't want any one to see this url when downloading or when viewing the page source. What's the best way to do it? Thanks, Jassim[^]
Technology News @ www.JassimRahma.com
You can't hide urls from the client. Implement proper security at the webserver level if you want to restrict access.
-
Hi, I have policies to documents and I want to put it on a web PHP portal for download to the employee with a password protected access. If the URL for a policy is www.myWeb.com/policies/document1.pdf, I don't want any one to see this url when downloading or when viewing the page source. What's the best way to do it? Thanks, Jassim[^]
Technology News @ www.JassimRahma.com
You could use the HTML5 download attribute like this:
-
Hi, I have policies to documents and I want to put it on a web PHP portal for download to the employee with a password protected access. If the URL for a policy is www.myWeb.com/policies/document1.pdf, I don't want any one to see this url when downloading or when viewing the page source. What's the best way to do it? Thanks, Jassim[^]
Technology News @ www.JassimRahma.com
This is how you can hide download url in PHP:
<?php
$fakeFileName= "fakeFileName.zip";
$realFileName = "realFileName.zip";$file = "downloadFolder/".$realFileName;
$fp = fopen($file, 'rb');header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$fakeFileName");
header("Content-Length: " . filesize($file));
fpassthru($fp);
?>You can see all steps to hide download url here http://5ss.co/viewtopic.php?f=26&p=3[^]