diff --git a/lcsv.php b/lcsv.php index c8f694c..a511557 100644 --- a/lcsv.php +++ b/lcsv.php @@ -27,6 +27,7 @@ class lcsv var $csvdata; var $str_separator; var $str_newline; + var $page_subheader; function separator() { @@ -121,17 +122,19 @@ class lcsv { if($this->csvdata) { + $filename=strtolower($this->page_subheader); + $filename=ereg_replace("[^a-z0-9]","_",$filename); //header("Content-type: application/csv"); header("Content-type: text/x-csv"); - header("Content-disposition: inline; filename=sfiab_".$this->page_subtitle.".csv"); + header("Content-disposition: inline; filename=sfiab_".$filename.".csv"); header("Content-length: ".strlen($this->csvdata)); echo $this->csvdata; } } - function lcsv($subtitle,$sep=",",$nl="\r\n") + function lcsv($subheader,$sep=",",$nl="\r\n") { - $this->page_subtitle=$subtitle; + $this->page_subheader=$subheader; $this->setSeparator($sep); $this->setNewline($nl);