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.
Save cookie to DB
I'm working on a pixel tracking script for an incentive website and I need to use an ASP script to save the cookie from the user to a MySQL DB via a 1 pixel image, such as follows.<img
Display data returned from Ajaxservices!!
I have a question about displaying results using ajax. I have part of the code below. $.ajax({ type: "POST", url: "AJAXServices.asmx/GetTechInfo", data: '{ "fieldName": ' +
Saas with SAP R/3
hi experts,
Please help with code for SMTP authenticated PHP email form
Hello, I'm creating a PHP email form, and for this particular server, I have to use SMTP Authentication. They hosting service sent me this link: http://email.about.com/od/emailprogramm ...
need help with php get
i have a option box that gets filled with dates, but how do i get once the option value has been clicked for example they select 2007 from the drop down, it then posts that value back to the same
download directory onto C drive
I am attempting (if this is possible) to write a routine to automatically dump the contents of a directory on the server into a directory on the local C drive.I started out like this :Code:
MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
If a form submits back to same page do you need to use $get
IM trying to pass page number and year that was selected back to the same page.i have this code Code: echo '<form action="archivedBookings.php" method="get">';
how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are two buttons. ob clicking first button i want to save user's provided data to the database display the
Quick fix: Conditional statement with an array
Hi, I'm getting the temperature value off of the Environment Canada website along with the icon filename, so I can display my own icons and temperature on my site. All this works and I can display the