Skip to content

Commit 7c371e1

Browse files
author
Roman Syroeshko
committed
Merged #532.
1 parent 5a22f57 commit 7c371e1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,14 @@ public function saveAs($fileName)
335335
unlink($fileName);
336336
}
337337

338-
rename($tempFileName, $fileName);
338+
/*
339+
* Note: we do not use ``rename`` function here, because it looses file ownership data on Windows platform.
340+
* As a result, user cannot open the file directly getting "Access denied" message.
341+
*
342+
* @see https://github.com/PHPOffice/PHPWord/issues/532
343+
*/
344+
copy($tempFileName, $fileName);
345+
unlink($tempFileName);
339346
}
340347

341348
/**

0 commit comments

Comments
 (0)