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.
Preserving user-entered linebreaks
Hi, I'm building a web 2.0 thingy from scratch and I wanna display text which users input. It's all good so far, except that all the linebreaks are destroyed, so no matter how carefully they insert
I need an iframe that calls up a different page according to the date
hiI don't know any php (only html) and I urgently need to do the following: I need an iframe that calls up a different page according to the date e.g. on the 2th Dec a page called 'special2.php',
How to validate from 2 possible answers
Hi I hope somebody can help me with what will probably be really simple, I'm pulling my hair trying to get my head round it.I've got a contact form and I would like to add to it a couple of simple
problem with query error
First Thanks to those who helped me on my previous posts, and the following code i'm using is not mine, i grabbed it from here http://www.phpfreaks.com/tutorial/basic-paginationNow onto the
first few characters only
hi, does anyone know how to use PHP to take the first few words of a text and limit them? i have seen this in many news sites where the news story headline reads like "woman found in obama's
getting a website's source code as a variable? How?
Hey guys, is there any way for me to get the source code of a website as a variable for me to work with?Ex:$url="http://www.google.com"$sourcecode=magicfunction($url);//so that i could
ALV List display - header width adjust
Hi,
Dynamic Data + Sql Server 2005 Enterprise?
Hi! I have just started to learn ASP.NET, and it looks like it is quite a lot to learn. Im not really sure where I should begin, but I have watched the Dynamic Data
array_combine() trouble w/csv file
I have a problem with a piece of code I wrote to import some records from a csv file into mysql. I have a .csv file with about 300 records in it. The code worked perfect while testing on 3 or 4
Module pool selction screen parameters combination logic
Hi floks,