diff --git a/main/exercice/question.class.php b/main/exercice/question.class.php index b0d0fcc8d2..a6f6c7f9e7 100644 --- a/main/exercice/question.class.php +++ b/main/exercice/question.class.php @@ -324,6 +324,20 @@ abstract class Question { global $picturePath, $_course, $_user; + if (!file_exists($picturePath)) { + if (mkdir($picturePath)) { + $perm = api_get_setting('permissions_for_new_directories'); + $perm = octdec(!empty($perm)?$perm:'0770'); + chmod($picturePath,$perm); + // document path + $documentPath = api_get_path(SYS_COURSE_PATH) . $_course['path'] . "/document"; + $path = str_replace($documentPath,'',$picturePath); + $title_path = basename($picturePath); + $doc_id = add_document($_course, $path, 'folder', 0,$title_path); + api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'FolderCreated', $_user['user_id']); + } + } + // if the question has got an ID if($this->id) {