Forum Moderators: coopster
I realise that the following code will go somewhere to helping, but I'm not sure how to make the button trigger the execution of this code.
$size_in_bytes = strlen($csv_output);
header("Content-disposition: attachment; filename=" .
date("Y-m-d").".csv; size=$size_in_bytes"); Its Tuesday today and I swear my brain thinks it's Monday.
Thanks for your help in advance
Check out the PHP Scripts Repository, there are a few classes there for generating CSV files that work pretty well.
http://www.phpclasses.org [phpclasses.org]
dc
from our PHP LIbrary [webmasterworld.com]
though coopster found a bug when trying to save the file, for me it works perfectly in the scenario you described
Note, this only happens on data pushed to the browser via echo/print. Files read from the filesystem work like a charm.
The simple resolution? Add a directive to your Apache configuration ...
<Files mydownloadscript.php>
BrowserMatch MSIE force-no-vary
</Files>
hence the long pounding of forehead against keyboard trying to keep IE from screwing things up as usual.
The fix above finally made it be adult about the whole thing and do what it was told. ;)
I'm gettin old,
Well, I'm pretty sure I have at least a decade on you and I can say that I've been debugging your posts and I think I've found your problem:
The fix above finally made it be adult about the whole thing and do what it was told. ;)
Adults don't do what they're told. Not unless they want to get old before their time.