Jagand Posted September 30, 2012 Share Posted September 30, 2012 Hi, I have a word document in a non-root folder and I wrote a code that allows users to download the file. Code is rename ("../cgifolder/docxfile.docx","docx/docxfile.docx"); header("Content-disposition: attachment; filename=docxfile.docx"); header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document'); readfile("docx/docxfile.docx"); I have two questions ... 1. I am seeing that downloaded content a corrupt file while file on server is MS2010 readable. What is wrong with my code? 2. Can I place files in cgi without renaming it to move to root folder and still allow users to download the file Thank you Link to comment https://forums.phpfreaks.com/topic/268949-php-force-docx-downloads/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.