Welcome to WebmasterWorld Guest from 23.22.136.56

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Create temp file, and download

     
2:35 am on Aug 12, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 30, 2008
posts:104
votes: 0


I'm trying to create a component of my page where I put the contents of a variable into a file, then download that file. I've looked at temporary files, but that doesn't make much sense to me.

Any suggestions?

2:58 am on Aug 12, 2009 (gmt 0)

Full Member

10+ Year Member

joined:June 1, 2007
posts:201
votes: 0


What type of file are you wanting to create .doc .csv .txt ?
2:23 am on Aug 14, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Jan 30, 2008
posts:104
votes: 0


A csv file. The content of the CSV file is saved to a regular variable.
2:46 am on Aug 14, 2009 (gmt 0)

Full Member

10+ Year Member

joined:June 1, 2007
posts:201
votes: 0


If you already can dump to the screen in the format you want just add something like this to the end of the page.


$file_out = $your_var;

$out = strlen($file_out);
if (isset($file_out)) {
header("Content-Length: $out");
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=$filename");
echo $file_out;
exit;
}

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members