CodeIgniter Forums
Download helper - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Download helper (/thread-25295.html)



Download helper - El Forum - 12-07-2009

[eluser]The Casual Bot[/eluser]
hey everyone


any one used the download helper

i got it to work (sort of)

however the file once download wont work apart from one pdf

and csv files but at the beginning of the csv files its add a few characters

so im guessing this is why some of the other files arent working


any ideas

Code:
function downloadfile() {
    $this->load->helper('download');
    $name = $_POST['name'];
    $path ="/home/sites/mysite.co.uk/public_html/files/".$_POST['id']."/".$_POST['name'];
    $data = file_get_contents($path);
    force_download($name, $data);
    }



Download helper - El Forum - 12-07-2009

[eluser]The Casual Bot[/eluser]
another point

is when useing

Code:
$data = "some text";
$name = test.txt

it seems to cut a few character of the text file so you end up with

some t


???