How to download a .vcf file correctly

自闭症网瘾萝莉.ら 提交于 2019-12-05 10:46:56

You have header('Connection: close'); which I would imagine closes the connection before the contents of the file are read. I've removed the line.

I'm not sure about case sensitivity in content-type so I changed it to x-vcard and I changed the content-disposition to inline (a known fix for download issues with IE). Try this:

$path = "../../media/resources/";  
$file = "Toni_Junas.vcf";  

header('Content-Type: text/x-vcard');  
header('Content-Disposition: inline; filename= "'.$file.'"');  
header('Content-Length: '.filesize($path.$file));  

readfile($path.$file);

Also, make sure the directory "resources" is readable (chmod 755 on the directory) and that the file exists...

put exit()

readfile($path.$file);
exit();
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!