protected function validateFile($path)
    {
        if (strpos($path, '../') !== false || strpos($path, '..\\') !== false) {
            throw new NotFoundException(__d('cake', 'The requested file contains `..` and will not be read.'));
        }
        if (!is_file($path)) {
            deprecationWarning(
                'Automatic prefixing of paths with `APP` by `Response::file()` and `withFile()` is deprecated. ' .
                'Use absolute paths instead.'
            );
            $path = APP . $path;
        }
        if (!Folder::isAbsolute($path)) {
            deprecationWarning(
                'Serving files via `file()` or `withFile()` using relative paths is deprecated.' .
                'Use an absolute path instead.'
            );
        }

        $file = new File($path);
        if (!$file->exists() || !$file->readable()) {
            if (Configure::read('debug')) {
                throw new NotFoundException(sprintf('The requested file %s was not found or not readable', $path));
            }
            throw new NotFoundException(__d('cake', 'The requested file was not found'));
        }

        return $file;
    }