I have a problem with word documentation generation when generating a word document (docx) with PHP. I am doing this for security reasons, as I do not want people to be able to directly access a file with urls, so I store the files above the web root and they are generated on the server side on demand. Here is my code for manually testing file generation of a .docx file ( a Word 2007 file ):
$path = "../../uploads_productionization/file_for_category_1_tab_2/adsfdafds.docx
// We'll be outputting a docx
header( 'Content-type: application/vnd.openxmlformats & -officedocument.wordprocessingml.document.main+xml');
// It will be called downloaded.docx
header('Content-Disposition: attachment; filename="downloaded.docx"');
// The word source is in adsfdafds.docx
readfile($path);
When I execute this code, ie when I manually generate a docx file, I get two error messages:
"The Open Office XML document cannot be opened because there are problems with the contents"
Details: "File is corrupt and cannot be opened"
Next message:
"Word found unreadable content in downloaded.docx. Do you want to recover the contents of this document? If so, please click Yes"
When I click Yes on the second message, the document opens. Sometimes the file is okay, sometimes it isn't when there are pictures and formatting and so on and so forth.
Anyone have a solution for this problem? Been trying to get around this for at least a week...
P.S. All other files, PDFs, text files, work fine.. I think it's just office documents.
Convert array to string and write to csv file
I am looking to write a MySQL query to a csv file.At the minute I:check for the original file, and delete it;create a new (blank) file;run the MySQL query and pass it into an array;write it to the new
Career Change into SAP
Hai
Error when call dll from oracle
Hi all, please help me!
Navigation include for all site directories
Hi,I need a navigation include that can deal with directories at different levels on a site. All I can seem to find are the basic includes for files all in the same directory. This doesn't work for me
Show message after entering data
Hello Colleagues I would like to display messages after entering the data example: " data were successfully " or " Error send data" in advance thanks.
Downloading file (Headers)
I'm trying to make users download a file, but they must wait 60 seconds before it begins.But, I'm stuck - the file isn't downloading, and no error is being shown (I've enabled E_ALL error
Converting from one format to another
"I have got a date in DD/MM/YYYY but I need it in MM-DD-YYYY. Help!"
Date Question
I'm using the TIMESTAMP() function within mysql to set the date/time for certain events. However, how would I go about formatting the output? For example it would display "2009-11-30
pop3 and fsockopen
So I am able to connect to the pop3 server, log in, and check how many messages there are. I am having a problem with server responses though.In the following code, I don't understand why on the
Mysql query, two times?
Hello to all,I'm new to php coding and i like it alot. I need help with some noob stuff.1. Having problem with mysql query after submiting HTML form. It's allways execuding two times, that way i have