Forum Moderators: coopster

Message Too Old, No Replies

i want to download the two different .csv file at the single click

download two different files on single click i

         

vinodkobal

7:03 am on Dec 8, 2011 (gmt 0)

10+ Year Member



hi following code i use

public function exportData($type,$empid) {

$exportPlugin = $this->_getPlugin($type);

$fileName = $exportPlugin->getName();
$csvContents = $exportPlugin->getHeader() . "\n" . $exportPlugin->getCSVData();
$toddayDate = date("d-m-Y");
$csvName = $fileName."_".$toddayDate;

ob_end_clean();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private", false);
header("Content-Type: text/csv");
header('Content-Disposition: attachment; filename="' . $csvName . '.csv";');
header("Content-Transfer-Encoding: none");

echo $csvContents;

}
in a above code i use $type for store two different type of plugin name but if i use array for name and use one by one it will give me only one file downloaded but not a 2nd one how should i get two files at the time in my download folder .
_getPlugin()i use for check the user get only that plugin which is in $type variable, in $csvContents stores the actual data which is collected by the getCSVData()

penders

8:24 am on Dec 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I may have misunderstood what you are trying to do, but I don't think you can do this. In order to download 2 files, you need to make 2 requests and consequently return 2 responses (and 2 complete response headers).

I think you need to either combine these 2 files server-side and send an archive .zip file or similar. OR somehow chain the requests, so that the first request triggers the second...?