I'm looking at changing our current intranet, which works with RTF files, so that it can work with docx.
We need to be able to change the templates, and after that inject it with some data from the intranet, and save it as a docx file.
For that I found TinyButStrong plugin, and it seems to be able to do, what we want.
I have done some tests, and can get it to save a file in the same folder as the template. But I can't get it to save in another location.
It gives me this error:
TinyButStrong Error OpenTBS Plugin: Method Flush() cannot overwrite the target file '//SERVER/SHARE/FOLDER/SUBFOLDER/ANOTHER SUBFOLDER/document name.docx'. This may not be a valid file path or the file may be locked by another process or because of a denied permission. The process is ending, unless you set NoErr property to true.
I don't think it's a premission error, cause I working in the same script which is working with our RTF files, and they get saved at the same location, as I need this to do.
But I'm sure it's just me, that doesn't understand TinyButStrong the right way, so how do I make it save on dynamic file path?
The following is where I try to handle the dynamical file path.
$file = "//$SERVER/$KATALOG/".$_GET['type'].$root.$nr."/"; //.$_GET['type'].$nr."R".$rev."-".$sprog.".rtf";
//echo $template;
$output_file_name = str_replace('.', '_'.date('Y-m-d').$save_as.'.', $filename);
echo $output_file_name = $file . $output_file_name;
if ($save_as==='') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name); // Also merges all [onshow] automatic fields.
// Be sure that no more output is done, otherwise the download file is corrupted with extra data.
exit();
} else {
// Output the result as a file on the server.
$TBS->Show(OPENTBS_FILE, $output_file_name); // Also merges all [onshow] automatic fields.
// The script can continue.
exit("File [$output_file_name] has been created.");
}