3 * jQuery File Upload Plugin PHP Example 5.7
4 * https://github.com/blueimp/jQuery-File-Upload
6 * Copyright 2010, Sebastian Tschan
9 * Licensed under the MIT license:
10 * http://www.opensource.org/licenses/MIT
13 error_reporting(E_ALL | E_STRICT);
15 require('upload.class.php');
17 $upload_handler = new UploadHandler();
19 header('Pragma: no-cache');
20 header('Cache-Control: no-store, no-cache, must-revalidate');
21 header('Content-Disposition: inline; filename="files.json"');
22 header('X-Content-Type-Options: nosniff');
23 header('Access-Control-Allow-Origin: *');
24 header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
25 header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
27 switch ($_SERVER['REQUEST_METHOD']) {
32 $upload_handler->get();
35 if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
36 $upload_handler->delete();
38 $upload_handler->post();
42 $upload_handler->delete();
45 header('HTTP/1.1 405 Method Not Allowed');