phpword-选择保存位置



我已经在网站上实现了phpword来生成模板。一切都很好,但是只有一个细节。当我的文件保存在我选择的网站中时,将副本保存在我的PHP脚本所在的目录中。

示例:我单击生成按钮,然后选择桌面以保存文件。好的但是在我的php" generate.php"的目录中,保存了生成文件的副本。

--//I type the name of my file.
$nombrearchivo = 'MOP_Implementacion MW_'.$sitene.'_to_'.$sitefe.'_Raylex.docx';

我保存文件

$templateWord->saveAs($nombrearchivo);
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header('Content-type: application/vnd.openxmlformats officedocument.wordprocessingml.document');
header('Content-Disposition: attachment; filename="'.$nombrearchivo.'"');
header("Content-Transfer-Encoding: binary ");
echo file_get_contents($nombrearchivo);

我得到解决方案: unlink($filename); // deletes the temporary file

最新更新