views:

26

answers:

1

Fast to explain, but i cant get it to work:

In this simple code, the function force_download simply doesn't make any output.

$this->load->helper('download');
$data = file_get_contents("modulos/".$filename); // Read the file's contents
force_download($filename, $data);
echo $data."/".$filename;

Here i just get a white screen, but the file content are show (well you now, the strange codified content :) I think it is simple enought, i just want the file downloaded with no other efect, am i doing something wrong?

A: 

Remove that echo $data."/".$filename; It should be like this

$this->load->helper('download');
$data = file_get_contents("modulos/".$filename); // Read the file's contents
force_download($filename, $data); 
Asif Mulla
I _think_ the echo is just in there for debugging purposes? Don't see why else anybody would put that there ;)
tilman
yes Tilman, the echo is there just for testing i was getting file contents properly.
Luis Javier Garrido