I'm using moodle's filemanager
elememnt to upload one file
Unfortunately Moodle's documentation is very badly organized and and incomplete
I can't understand how should I work with the damn filemanager
!
Currently I'm doing it like this:
// populating database record object in $record
// ...
$insertid = $DB->insert_record('local_usercertlist', $record);
$draftitemid = file_get_submitted_draft_itemid('pic');
file_save_draft_area_files($draftitemid, $PAGE->context->id, 'local_usercertlist', "type1_{$fromform->uid}", $insertid, array('subdirs' => false, 'maxfiles' => 1));
But now I don't know How should I retrieve the uploaded file!
Moodle's documentation says to use moodle_url::make_pluginfile_url()
method, but it needs path
and filename
and where can I find them ?!
can anyone tell me what is the correct sequence for uploading & retrieving a file in moodle ?!