stevesimo Posted November 14, 2008 Share Posted November 14, 2008 Hi, my client has asked me to generate a CSV file or Excel file which is straight forward enough to do. The complication is that they have asked if the file can be password protected. Does anyone know how I could achieve this. Is it actually possible to do this with PHP? Any advice on this subject would be appreciated. Steve Link to comment https://forums.phpfreaks.com/topic/132682-password-protect-excel-or-csv-file/ Share on other sites More sharing options...
Mark Baker Posted November 14, 2008 Share Posted November 14, 2008 Hi, my client has asked me to generate a CSV file or Excel file which is straight forward enough to do. The complication is that they have asked if the file can be password protected. Does anyone know how I could achieve this. Is it actually possible to do this with PHP? About the only way to password protect a text file such as a CSV would be to zip it up in a password-protected zip. If you want to write the data to an Excel file, that can be password-protected. Link to comment https://forums.phpfreaks.com/topic/132682-password-protect-excel-or-csv-file/#findComment-690125 Share on other sites More sharing options...
DarkerAngel Posted November 14, 2008 Share Posted November 14, 2008 This can also be done with PHP, but I'm not going to write [all] the code for you. <?php /** User Check / Login Code / Password Check **/ if( file_exist($_GET['file']) ) { header('Content-Length: '.filesize($_GET['file']); header("Content-Disposition: attachment; filename=\"{$_GET['file']}\""); header('Content-type: application/vnd.ms-excel'); readfile($_GET['file']); } Link to comment https://forums.phpfreaks.com/topic/132682-password-protect-excel-or-csv-file/#findComment-690139 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.