Search code examples
phpms-wordtinybutstrong

Load MS Word 2007 document with TinyButStrong class and no file extension .docx


I try to merge documents, with TBS library, but when I try to load a MS Word 2007 doc with $tbs->LoadTemplate($path_file). It doesn't work, I have no error, but the file generated is corrupted.

I know where the problem come from : $path_file has no extension .docx because if I try to load a file with .docx extension, all work properly. But I can't use this way, I must use file without extention (Files are uploaded by users on server and stored with no extension, and I can't change functions to upload files).

So what I want know is how can I open .docx whithout extension with TBS ?


Solution

  • Problem resolves by creating a temp file with extension file (extension is stored in database). I load the template using temp, and I delete it just after.