Revision #7 was created by Scott_Huang on Jun 16, 2015, 4:11:48 PM.
correct one error.
Content
[...]
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$tempDir = Yii::getAlias('@webroot') . '/uploads/temp/';
if (!is_dir($tempDir)) { mkdir(Yii::getAlias('@webroot').'/uploads');//need 2 steps to avoid error
mkdir($tempDir);
chmod($tempDir, 0755);
// the default implementation makes it under 777 permission, which you could possibly change recursively before deployment, but here's less of a headache in case you don't
}
$file_name = $tempDir . yii::$app->user->identity->username . '-' . str_replace(array('/', '*', '?', '\\', ':', '[', ']'), array('_', '_', '_', '_', '_', '_', '_'), $excel_file) . '-' . date('Ymd-His') . '.xlsx';