Hi!
Can anyone tell me how to send a csv file to the user by showing the save file dialog? I try something like this.
I think it's because cf sends another header bevore my code, because I have all the cf code in a blank page. How can I avoid this?
cheers
marcus
Can anyone tell me how to send a csv file to the user by showing the save file dialog? I try something like this.
$fd = @fopen( $realfilename, "r" ) or die ( "Cannot open file" );
header("Content-Disposition: attachment; filename=$file");
header("Content-Type: application/zip"); // filetype
header("Content-Length: ".filesize( $realfilename )); // filesize
header("Pragma: no-cache");
header("Expires: 0");
// send
fpassthru( $fd );
fclose( $fd );
exit();
I think it's because cf sends another header bevore my code, because I have all the cf code in a blank page. How can I avoid this?
cheers
marcus
Hi,this code does it from the Chronoforms admin functions :
if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {
$UserBrowser = "Opera";
}
elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {
$UserBrowser = "IE";
} else {
$UserBrowser = '';
}
$mime_type = ($UserBrowser == 'IE' || $UserBrowser == 'Opera') ? 'application/octetstream' : 'application/octet-stream';
@ob_end_clean();
ob_start();
header('Content-Type: ' . $mime_type);
header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
if ($UserBrowser == 'IE') {
header('Content-Disposition: inline; filename="' . $rows[0]->name.'.cfbak"');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
}
else {
header('Content-Disposition: attachment; filename="' . $rows[0]->name.'.cfbak"');
header('Pragma: no-cache');
}
print $string;
exit();
Hi guys
First of all thankyou to the developers for the great work you're doing!!!! 😀
I read this topic because I have a similar issue. After someone submits a form I would like him to recieve a pdf file. Using a save file dialog would be great! Now I read this thread but couldn't make out how to make this work. Do I have to insert the code shown somewhere or was that just a hint on where to put in some piece of code to make it work.
Another possibility would be to send the pdf after with a confirmation eMail. Is there a way to do this easily?
Many thanx in advance for helping me :wink: .
Kind regards,
*Miki
First of all thankyou to the developers for the great work you're doing!!!! 😀
I read this topic because I have a similar issue. After someone submits a form I would like him to recieve a pdf file. Using a save file dialog would be great! Now I read this thread but couldn't make out how to make this work. Do I have to insert the code shown somewhere or was that just a hint on where to put in some piece of code to make it work.
Another possibility would be to send the pdf after with a confirmation eMail. Is there a way to do this easily?
Many thanx in advance for helping me :wink: .
Kind regards,
*Miki
This topic is locked and no more replies can be posted.