diff options
author | Sem <sembrestels@riseup.net> | 2012-07-29 10:15:17 +0200 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2012-07-29 10:15:17 +0200 |
commit | d00e34131d6177f6d22eb3cf32c50216820aafba (patch) | |
tree | 8adfab83855f19bc1de2273216707da99bec9c1d /vendors/jquery-file-upload/server/php/index.php | |
parent | 24ff6662195222479b4d83d41fa89edc8a3c05d1 (diff) | |
download | elgg-d00e34131d6177f6d22eb3cf32c50216820aafba.tar.gz elgg-d00e34131d6177f6d22eb3cf32c50216820aafba.tar.bz2 |
Added jquery file upload plugin: https://github.com/blueimp/jQuery-File-Upload
Diffstat (limited to 'vendors/jquery-file-upload/server/php/index.php')
-rw-r--r-- | vendors/jquery-file-upload/server/php/index.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/vendors/jquery-file-upload/server/php/index.php b/vendors/jquery-file-upload/server/php/index.php new file mode 100644 index 000000000..1601c76f3 --- /dev/null +++ b/vendors/jquery-file-upload/server/php/index.php @@ -0,0 +1,46 @@ +<?php +/* + * jQuery File Upload Plugin PHP Example 5.7 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://www.opensource.org/licenses/MIT + */ + +error_reporting(E_ALL | E_STRICT); + +require('upload.class.php'); + +$upload_handler = new UploadHandler(); + +header('Pragma: no-cache'); +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Content-Disposition: inline; filename="files.json"'); +header('X-Content-Type-Options: nosniff'); +header('Access-Control-Allow-Origin: *'); +header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE'); +header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size'); + +switch ($_SERVER['REQUEST_METHOD']) { + case 'OPTIONS': + break; + case 'HEAD': + case 'GET': + $upload_handler->get(); + break; + case 'POST': + if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') { + $upload_handler->delete(); + } else { + $upload_handler->post(); + } + break; + case 'DELETE': + $upload_handler->delete(); + break; + default: + header('HTTP/1.1 405 Method Not Allowed'); +} |