throw new moodle_exception('nofile');
}
// saving file
- if (!file_exists($CFG->dataroot.'/temp/wsupload')) {
- mkdir($CFG->dataroot.'/temp/wsupload/', 0777, true);
- }
-
- if (is_dir($CFG->dataroot.'/temp/wsupload')) {
- $dir = $CFG->dataroot.'/temp/wsupload/';
- } else {
+ if (!check_dir_exists($CFG->dataroot.'/temp/wsupload')) {
throw new moodle_exception('cannotcreatetempdir');
}
+
if (empty($fileinfo['filename'])) {
$filename = uniqid('wsupload').'_'.time().'.tmp';
} else {