$config, )); } $file = new File($config, $request); if ($_SERVER['REQUEST_METHOD'] === 'GET') { if ($file->checkChunk()) { header("HTTP/1.1 200 Ok"); } else { // The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields. header("HTTP/1.1 204 No Content"); return false; } } else { if ($file->validateChunk()) { $file->saveChunk(); } else { // error, invalid chunk upload request, retry header("HTTP/1.1 400 Bad Request"); return false; } } if ($file->validateFile() && $file->save($destination)) { return true; } return false; } }