MDL-60302 webservice: Allow CORS requests in webservice/upload.php

This will allow to upload files via Web Services using AJAX from
different domains, browser plugins, web apps, etc…
This commit is contained in:
Juan Leyva
2017-10-04 12:39:51 +02:00
parent 23ab0d7788
commit e348f6a541
+4
View File
@@ -43,6 +43,10 @@ define('NO_MOODLE_COOKIES', true);
require_once(__DIR__ . '/../config.php');
require_once($CFG->dirroot . '/webservice/lib.php');
// Allow CORS requests.
header('Access-Control-Allow-Origin: *');
$filepath = optional_param('filepath', '/', PARAM_PATH);
$itemid = optional_param('itemid', 0, PARAM_INT);