Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

External files API

Copyright: 2010 Dongsheng Cai
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 403 lines (16 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