Welcome Guest, Not a member yet? Register   Sign In
File helper() write file? Download prompt!
#1

[eluser]brucebat[/eluser]
Hi all,

I have been playing around with the file helper class.

Basically I want a query result in a csv file to be downloaded by the user, NOT written to a folder somewhere.

So this is what happens:

-Enters query (works)
-Query result in CSV (works)
-Query result in file, download prompt for user to download .csv file (not functioning)

This is what I have

Code:
//csv data
$csv

write_file('', $csv);

I had a look at the File Helper but no code relevant to what I am trying to achieve.

Thanks for your time Smile
#2

[eluser]Near[/eluser]
http://ellislab.com/forums/viewthread/196559/
#3

[eluser]Near[/eluser]
Click here

hope it works for you too... :-)
#4

[eluser]bubbafoley[/eluser]
use the download helper

Code:
$this->load->helper('download');

$data = 'Here is some text!';
$name = 'mytext.txt';

force_download($name, $data);

http://ellislab.com/codeigniter/user-gui...elper.html
#5

[eluser]brucebat[/eluser]
Thanks bubbofoley this was what I wanted to hear ! Smile




Theme © iAndrew 2016 - Forum software by © MyBB