0

For some reason, with this code:

header("Content-Type: text/x-vcard;charset=utf-8;");
header("Content-Disposition: attachment; filename=card.vcf");
header("Pragma: no-cache");
header("Expires: 0");

echo $vcard_serialized;

on chrome from Pc, it downloads card.vcf, but from mobile it downloads card.vcf.html... why?

Alberto Sinigaglia
  • 12,097
  • 2
  • 20
  • 48

1 Answers1

0

I have the same issue, but now I already fixed it using the codes below:

header('Content-Description: Download vCard');
header('Content-Type: text/vcard');
header('Content-Disposition: attachment; filename='.$your_filename_here);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
ob_clean();
flush();
echo $vcard_serialized; //echo the content
exit;
not_null
  • 111
  • 10