php - Google Chrome 将文件 .xml 重命名为 .download

标签 php html xml google-chrome

我有这个非常简单的下载页面来获取 xml 文件。 该脚本在 firefox/IE 中运行正常。但 chrome 将文件的扩展名重命名为“.download”。 这只会发生在 .xml 上,当您使用另一个扩展名(如 .txt)时,它可以毫无问题地完成。

html 的主体是这样的:

<body>
  <a href="down.php">descarga</a>
</body>

PHP 是这样的:

header('Content-type: "text/xml"; charset="utf8"');
header('Content-disposition: attachment; filename="example.xml"');
echo "that's it";

这很奇怪。有什么解决办法吗??

最佳答案

这不是一个确定的答案,只是一些信息给你。

来自bug report :

The downloaded file may get a different name if it is considered potentially dangerous for your computer (e.g. exe). You should then get an UI prompt in the download shelf asking you to confirm the download (with the file still downloading in the background).

关于php - Google Chrome 将文件 .xml 重命名为 .download,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3096146/

相关文章:

PHP MySQL 注入(inject)安全 : Does verifying that $_GET input is numeric provide enough protection?

html - 我怎样才能将我的网站放大到 120%,并将字体大小放大到 150%?

java - 如何读取XML文件?谷歌应用引擎端点

php - 通过 PHP Mysql 搜索

php - Apache 显示 PHP 代码而不是执行它

.net - 如何使用 WebClient 通过身份验证以编程方式发布到远程网站?

javascript - 在 Chrome 中禁用父跨度而不禁用子复选框

javascript - 如何在java中将NCPDP标准格式消息转换为xml格式?

java - 如何从 Android GridView onItemClick 添加新 Activity ?

php - 编写干净的多维数组