Get the App
SLTechnology News&Howtos  ›  Development  › 

How to download files with hidden actual address by php

Shulou Source: shulou.com Published: 2022-06-03 19:44:27 10月02日 Update

This article mainly introduces php how to hide the actual address of the file download, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

The details are as follows:

The following php code does not reveal the actual download address of the file.

Function download_document ($filename,$path= ", $mimetype=" application/octet-stream ") {header (" Cache-Control: must-revalidate, post-check=0, pre-check=0 "); header (" Content-Disposition: attachment; filename = $filename "); header (" Content-Length: ". Filesize ($pathto. $filename); header ("Content-Type: $mimetype"); echo file_get_contents ($pathto. $filename);}

Implementation method 2:

Thank you for reading this article carefully. I hope the article "how to download files with hidden actual addresses in php" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Tags: Articles addresses actual documents file downloads but not code value interests at the same time methods more friends knowledge editing industry information information channels channels references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Microsoft NVidia Redmi Shulou Information