Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 402] [Versions 39 and 403]

External files API

Copyright: 2010 Dongsheng Cai
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 389 lines (17 kb)
Included or required:0 times
Referenced: 5 times
Includes or requires: 0 files

Defines 1 class

core_files_external:: (6 methods):
  get_files_parameters()
  get_files()
  get_files_returns()
  upload_parameters()
  upload()
  upload_returns()


Class: core_files_external  - X-Ref

Files external functions

get_files_parameters()   X-Ref
Returns description of get_files parameters

return: external_function_parameters

get_files($contextid, $component, $filearea, $itemid, $filepath, $filename, $modified = null,$contextlevel = null, $instanceid = null)   X-Ref
Return moodle files listing

param: int $contextid context id
param: int $component component
param: int $filearea file area
param: int $itemid item id
param: string $filepath file path
param: string $filename file name
param: int $modified timestamp to return files changed after this time.
param: string $contextlevel The context level for the file location.
param: int $instanceid The instance id for where the file is located.
return: array

get_files_returns()   X-Ref
Returns description of get_files returns

return: external_single_structure

upload_parameters()   X-Ref
Returns description of upload parameters

return: external_function_parameters

upload($contextid, $component, $filearea, $itemid, $filepath, $filename, $filecontent, $contextlevel, $instanceid)   X-Ref
Uploading a file to moodle

param: int    $contextid    context id
param: string $component    component
param: string $filearea     file area
param: int    $itemid       item id
param: string $filepath     file path
param: string $filename     file name
param: string $filecontent  file content
param: string $contextlevel Context level (block, course, coursecat, system, user or module)
param: int    $instanceid   Instance id of the item associated with the context level
return: array

upload_returns()   X-Ref
Returns description of upload returns

return: external_single_structure