I have the following file.php
. My PDF is in a files folder, file.php
, and its file are in the same directory. When I press the button, the PDF is not downloading but the file.php
is.
<?php
if (isset($_POST['file_name'])){
$file= $_POST['file_name'];
header('Content- type: application/pdf');
header('Content-Disposition: attachament; filename: " .$files"');
readfile('files/'.$file);
exit();
}
?>
<form action="file.php" method="POST" >
<input name="file_name" value="cv.pdf" type="hidden">
<input type="submit" value="Download CV">
</form>
$files
inheader('Content-Disposition: attachament; filename: " .$files"');
?