Excel export returns a zero bytes file when system temp not writable MDL-7176

This commit is contained in:
skodak
2006-10-23 19:25:13 +00:00
parent fb4f768789
commit cca1df961b
+4
View File
@@ -46,10 +46,14 @@ class MoodleExcelWorkbook {
* @param string $filename The name of the file
*/
function MoodleExcelWorkbook($filename) {
global $CFG;
/// Internally, create one PEAR Spreadsheet_Excel_Writer_Workbook class
$this->pear_excel_workbook = new Spreadsheet_Excel_Writer($filename);
/// Prepare it to accept UTF-16LE data and to encode it properly
$this->pear_excel_workbook->setVersion(8);
/// Choose our temporary directory, because default system tmp might not be writable - see MDL-7176, found by paulo.matos
make_upload_directory('temp/excel', false);
$this->pear_excel_workbook->setTempDir($CFG->dataroot.'/temp/excel');
}
/* Create one Moodle Worksheet