Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <a href="pdf_server.php?file=pdffilename">Download my eBook</a>
- header("Content-Type: application/octet-stream");
- $file = $_GET["file"] .".pdf";
- header("Content-Disposition: attachment; filename=" . urlencode($file));
- header("Content-Type: application/force-download");
- header("Content-Type: application/octet-stream");
- header("Content-Type: application/download");
- header("Content-Description: File Transfer");
- header("Content-Length: " . filesize($file));
- flush(); // this doesn't really matter.
- $fp = fopen($file, "r");
- while (!feof($fp))
- {
- echo fread($fp, 65536);
- flush(); // this is essential for large downloads
- }
- fclose($fp);
- header("Content-Type: application/octet-stream");
- def index
- respond_to do |format|
- format.html # Your HTML view
- format.pdf { render :layout => false }
- end
- end
Add Comment
Please, Sign In to add comment