diff mod_http_upload_external/share.php @ 3226:3b13f19652e2

mod_http_upload_external: Update share.php and share_v2.php to allow cross-domain requests
author Matthew Wild <mwild1@gmail.com>
date Tue, 14 Aug 2018 17:47:44 +0100
parents 5d35e6b409e0
children 62c82d097017
line wrap: on
line diff
--- a/mod_http_upload_external/share.php	Mon Aug 13 03:35:42 2018 +0200
+++ b/mod_http_upload_external/share.php	Tue Aug 14 17:47:44 2018 +0100
@@ -69,6 +69,12 @@
 
 $request_method = $_SERVER['REQUEST_METHOD'];
 
+/* Set CORS headers */
+header('Access-Control-Allow-Methods: GET, PUT, OPTIONS');
+header('Access-Control-Allow-Headers: Content-Type');
+header('Access-Control-Max-Age: 7200');
+header('Access-Control-Allow-Origin: *');
+
 if(array_key_exists('v', $_GET) === TRUE && $request_method === 'PUT') {
 	$upload_file_size = $_SERVER['CONTENT_LENGTH'];
 	$upload_token = $_GET['v'];
@@ -122,6 +128,7 @@
 	} else {
 		header('HTTP/1.0 404 Not Found');
 	}
+} else if($request_method === 'OPTIONS') {
 } else {
 	header('HTTP/1.0 400 Bad Request');
 }