Skip to content

Commit

Permalink
MDL-23984 using standard check_dir_exists() in extlib
Browse files Browse the repository at this point in the history
  • Loading branch information
skodak committed Aug 29, 2010
1 parent ab4aa56 commit 882efc3
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions files/externallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,10 @@ public static function upload($contextid, $component, $filearea, $itemid, $filep
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 {
Expand Down

0 comments on commit 882efc3

Please sign in to comment.