Jump to content

Private File


jonybhi

Recommended Posts

here is a script that I use for a pdf file download:

 

<?php

       $file="myfile.pdf" // add file's url to this variable
       header("Content-type: application/force-download");
       header('Content-Disposition: inline; filename="' .$file . '"');
       header("Content-Transfer-Encoding: Binary");
       header("Content-length: ".filesize($file));
       header('Content-Type: application/octet-stream');
       header('Content-Disposition: attachment; filename="' . $file . '"');
       readfile("$file");

?>

 

you will need to validate member before allowing them to access this script.

Link to comment
https://forums.phpfreaks.com/topic/81146-private-file/#findComment-411778
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.