throw new moodle_exception('nofile');
}
// saving file
- $dir = make_upload_directory('temp/wsupload');
+ $dir = make_temp_directory('wsupload');
if (empty($fileinfo['filename'])) {
- $filename = uniqid('wsupload').'_'.time().'.tmp';
+ $filename = uniqid('wsupload', true).'_'.time().'.tmp';
} else {
$filename = $fileinfo['filename'];
}
*/
public function prepare_file($filename) {
global $CFG;
- if (!file_exists($CFG->dataroot.'/temp/download')) {
- mkdir($CFG->dataroot.'/temp/download/', $CFG->directorypermissions, true);
+ if (!file_exists($CFG->tempdir.'/download')) {
+ mkdir($CFG->tempdir.'/download/', $CFG->directorypermissions, true);
}
- if (is_dir($CFG->dataroot.'/temp/download')) {
- $dir = $CFG->dataroot.'/temp/download/';
+ if (is_dir($CFG->tempdir.'/download')) {
+ $dir = $CFG->tempdir.'/download/';
}
if (empty($filename)) {
- $filename = uniqid('repo').'_'.time().'.tmp';
+ $filename = uniqid('repo', true).'_'.time().'.tmp';
}
if (file_exists($dir.$filename)) {
$filename = uniqid('m').$filename;