if ($method == 'OPTIONS') { handlePreflight(); } else { if ($method == "DELETE") { handlePreflightedRequest(); // only needed in a CORS environment deleteObject(); } else { if ($method == 'POST') { handlePreflightedRequest(); // Assumes the successEndpoint has a parameter of "success" associated with it, // to allow the server to differentiate between a successEndpoint request // and other POST requests (all requests are sent to the same endpoint in this example). // This condition is not needed if you don't require a callback on upload success. if (isset($_REQUEST["success"])) { verifyFileInS3(shouldIncludeThumbnail()); } else { signRequest(); } } } } // This will retrieve the "intended" request method. Normally, this is the // actual method of the request. Sometimes, though, the intended request method // must be hidden in the parameters of the request. For example, when attempting to // send a DELETE request in a cross-origin environment in IE9 or older, it is not // possible to send a DELETE request. So, we send a POST with the intended method, // DELETE, in a "_method" parameter. function getRequestMethod() { global $HTTP_RAW_POST_DATA;
// otherwise your policy document will be invalid. // http://docs.fineuploader.com/branch/develop/api/options.html#validation-option $expectedMaxSize = null; $method = getRequestMethod(); // This second conditional will only ever evaluate to true if // the delete file feature is enabled if ($method == "DELETE") { deleteObject(); } else { if ($method == 'POST') { // Assumes the successEndpoint has a parameter of "success" associated with it, // to allow the server to differentiate between a successEndpoint request // and other POST requests (all requests are sent to the same endpoint in this example). // This condition is not needed if you don't require a callback on upload success. if (isset($_REQUEST["success"])) { verifyFileInS3(); } else { signRequest(); } } } // This will retrieve the "intended" request method. Normally, this is the // actual method of the request. Sometimes, though, the intended request method // must be hidden in the parameters of the request. For example, when attempting to // send a DELETE request in a cross-origin environment in IE9 or older, it is not // possible to send a DELETE request. So, we send a POST with the intended method, // DELETE, in a "_method" parameter. function getRequestMethod() { if ($_POST['_method'] != null) { return $_POST['_method'];