php下载文件名

时间:2014-04-28 05:17:57

标签: php html download

我正在寻找为下载文件设置同名的可能性。

我正在编写类似基于html的编辑器,但文件应采用特殊格式,在表单提交后在服务器端构建。

至于现在我看到如果我已经拥有该名称的文件 - 浏览器提供我"名称(X).ext",其中x是1到无穷大。

php代码是:

  header('Content-type: application/xhtml+xml');
  header("Content-Length: $data_length");
  header("Content-Disposition: attachment; filename=$file_name.xml");
  header('Content-Transfer-Encoding: binary');
  header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  echo $data; 

0 个答案:

没有答案