Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 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: 3 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