Welcome Guest, Not a member yet? Register   Sign In
Need help getting Force Download to work
#1

[eluser]brent7779[/eluser]
Please excuse my newbieness, but this seems so very simple, i copied the code directly from the user guide and i can't understand why this function doesn't auto download as soon as the "download.php" controller is called up, i want to avoid the download being possible by using a direct url like - http://www.mysite.com/index.php/download/getpdf... so, I put the underscore in front of the function name and put that function inside of the index function for this controller, so what gives? nothing happens at all, I get no php errors or anything, its not the wrong path to file, just nothing happens...



<?php

class Download extends Controller {

function index() {

$this->load->helper('download');
$this->load->view('header_view');
$this->load->view('download_view');
$this->load->view('footer_view');

function _getpdf() {
$data = file_get_contents("../../filename.pdf"); // Read the file's contents
$name = 'filename.pdf';

force_download($name, $data);
}



}
}
?>


Messages In This Thread
Need help getting Force Download to work - by El Forum - 11-06-2010, 10:26 AM
Need help getting Force Download to work - by El Forum - 11-06-2010, 11:10 AM
Need help getting Force Download to work - by El Forum - 11-06-2010, 12:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB