static function uploadFile($path, $filename, $maxSize = 2097152)
    {
        $inputFile = file_get_contents('php://input', null, null, null, $maxSize);

        // Else try to get GET data
        if ($inputFile === false && array_key_exists('input', $_GET)) {
            $inputFile = $_GET['input'];
        }

        // Check for error
        if ($inputFile === false) {
            throw new \Exception('Couldn\'t read input file');
        }
        if (!file_put_contents($path . $filename, $inputFile)) {
            throw new \Exception('Couldn\'t save input file to ' . $path . $filename);
        }
        if (filesize($path . $filename) > $maxSize) {
            // Not sure if usefull here
            unlink($path . $filename);
            throw new FileTooLargeException();
        }
    }