public function move($path, $file = null, $overwrite = false)
    {
        if (!$this->isValid()) {
            throw new UploadedFileException('Upload was not successful - '.$this->getErrorMessage());
        }

        $target = $this->getTarget($path, $file);

        if (!$overwrite && is_file($target)) {
            throw new UploadedFileException(sprintf('Could not move the file "%s" to "%s" ( Target file already exists )', $this->getPathname(), $target));
        }

        if (!move_uploaded_file($this->getPathname(), $target)) {
            $error = error_get_last();
            throw new UploadedFileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message'])));
        }

        chmod($target, 0666 & ~umask());

        return new \SplFileObject($target);
    }