joomla1.5 - CSV Export returning index.php not able to download instead of open CSV file -
i have employee record calling server using crul, process result , create csv file , offer download or open. when clicked open opens csv file .html extension in browser , when clicked on save option says "unable download index.php file sitename.com".
here php code it:
$url = 'sitename.com/myemployee.php?mid=101'; $headers[] = 'content-type: content-type: text/csv; charset=utf-8'; $process = curl_init(); curl_setopt($process, curlopt_url, $url); curl_setopt($process, curlopt_httpheader, $headers); curl_setopt($process, curlopt_header, 0); curl_setopt($process, curlopt_referer, "my_employee"); curl_setopt($process, curlopt_timeout, 30); curl_setopt($process, curlopt_returntransfer, 1); curl_setopt($process, curlopt_followlocation, 1); $return = curl_exec($process); curl_close($process); header('content-type: text/csv'); header('cache-control: cache, must-revalidate'); header('pragma: public'); header('expires: sat, 6 may 1995 12:00:00 gmt'); header('content-disposition: attachment; filename=myemployeesreport.csv'); echo $return;
i using windows7 , ie 9.
thanks
Comments
Post a Comment