From 311076f3a25a6ee9981008be7d63b70be3161906 Mon Sep 17 00:00:00 2001 From: Juan Leyva Date: Wed, 4 Oct 2017 12:39:51 +0200 Subject: [PATCH] MDL-60424 webservice: Allow CORS requests in webservice/upload.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will allow to upload files via Web Services using AJAX from different domains, browser plugins, web apps, etc… --- webservice/upload.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webservice/upload.php b/webservice/upload.php index 1550ee5ffd898..9f34565672d6d 100644 --- a/webservice/upload.php +++ b/webservice/upload.php @@ -43,6 +43,10 @@ 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);