Hi,
If i make a docx file and at the end i use createDocxAndDownload('filename') the downloaded file always have the name document.docx. I think there is a bug in this function because, first there will be checked or $args[0] exists. In the If is on logica, then there will be checked if $args[2] exists, the variable $fileNameAndDownload will be overridden and the document always have the name document.docx
My solution is to change te following code:
if (!empty($args[0])) {
$fileName = $args[0];
$completeName = explode("/", $args[0]);
$fileNameDownload = array_pop($completeName);
} else {
$fileName = 'document';
$fileNameDownload = 'document';
}
if (!empty($args[2])) {
$fileNameDownload = $args[2];
} else {
$fileNameDownload = 'document.docx';
}
to this:
if (!empty($args[0])) {
$fileName = $args[0];
$completeName = explode("/", $args[0]);
$fileNameDownload = array_pop($completeName) . '.docx';
} else {
$fileNameDownload = 'document.docx';
}
Do anybody else have the same problem?