• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Mobile browsers are adding .html to filename on download

phpfilemobilefile-extensionvcf-vcard


PHP Snippet 1:

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;

Related Snippets

Install mysql client in docker image

Yii2: How to download backup files using spanjeta/yii2-backup?

Adding one microsecond to Datetime object in PHP

How to add a sidebar to Woocommerce Shop Page?

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Change user role if checkout custom checkbox is checked in WooCommerce

How to validate Envato Purchase Code in PHP

Limit login attempts in Laravel 5.7

Transform array, set each array element with parent key php

Adding reCAPTCHA v2 into my PHP file

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in

Laravel Mix Uncaught ReferenceError: $ is not defined

Symfony - "framework.test" config is not set to true

Laravel: Create morphs() relationship nullable

About Contact Privacy policy Terms and conditions