Excel export returns a zero bytes file when system temp not writable MDL-7176
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user