php is a way for browsers to download pdf files directly
- 2020-11-25 07:12:18
- OfStack
Some browsers have an pdf launcher attached to the browser, so when you write pdf directly, you open pdf instead of downloading it. I'll say if you want them to just download it, not browse it.
Create 1 php file
Add the code to turn the pdf path into a language that the browser knows, and tell the browser
Example/upload php? file=/aa/aa.pdf
So whatever it is, it will download it, not open it, right
Create 1 php file
<?php
$file = $_GET['file'];
$arr = explode('/',$file);
header('Content-type: application/pdf');
header('Content-Disposition: attachment; filename="'.array_pop($arr).'"');
readfile(file);
?>
Add the code to turn the pdf path into a language that the browser knows, and tell the browser
Example/upload php? file=/aa/aa.pdf
So whatever it is, it will download it, not open it, right