Good afternoon, I'm using this routine to force a download with php
require_once 'PHPWord.php';
require_once 'PHPWord/Template.php';
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$document = $PHPWord->loadTemplate('models/Mod.docx');
$document->setValue('NOTA_TECNICA',ex01457);
$document->setValue('NUM',ex16050);
$document->setValue('FUNCIONARIO_01','exFuncionario');
$nomefile="ex01457"."_"."exFuncionario";
$nota="ofi/NT".$nomefile.".docx";
$document->save($nota);
// Fazendo download do arquivo
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$nota);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . filesize($nota));
flush();
readfile($nota);
unlink($nota); // deletes the temporary file
//Fim do download
unset($template);
When the user downloads the "Save As" window,
Can you tell if the user saved the file? In this window the user has the option "Save" or "Cancel". How can I know what action the user took? Through the answer I will create a routine to save in the database, along with the user login.
PS: I'm using PHP version 5.3.5, testing locally with Wamp in Windows 10.
Obriado, Thiago P.