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

[eluser]brent7779[/eluser]
Thanks alot vitoco for your quick response, I can't wait to try your solution, I will post back as soon as I can try it!



Oh, one more thing, it was my understanding that in order to make a function private the underscore had to precede everything else, no?
"_getpdf()"
and if I call the method from a view, I can't use the underscore in the path cause it will give 404 error right?
Code:
<?php
  
// THIS WORK IF YOU CALL http://domain/download/_getpdf/
class Download extends Controller {
  
  // shows a link to download the pdf
  function index()
  {
      echo base_url().'/download/_getpdf';
  }

  function _getpdf()
  {    
      $data = file_get_contents(”../../filename.pdf”); // Read the file’s contents
      $name = ‘filename.pdf’;
      //
      force_download($name, $data);
   }
}
?>

I would like to avoid making the user click another link, they have already filled out my form and gone through paypal at this point, that's why I wanted the download method nested in the index method for that controller and auto download.

Thanks again, I really appreciate you guys helping out the newbies here!


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