我正在寻找为下载文件设置同名的可能性。
我正在编写类似基于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;