Can I upload a file to the site so that it is not accessible via an HTML page?

After uploaded your pdf file just do some step to hide pdf or uploads folder files that no one view those files except direct link.

To do that:

# Disable Directory Browsing
simply add this small piece of code to your .htaccess file

Options All -Indexes

Or you can also block wp-content/uploads and specific pdf files from any user or viewer by adding this.

# Block files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-content/uploads/ - [F,L]
RewriteRule !^wp-content/ - [S=3]
RewriteRule ^wp-content/[^/]+\.pdf$ - [F,L]
</IfModule>

Note: to ensure the code below is not overwritten by WordPress, place
it outside the # BEGIN WordPress and # END WordPress tags in the
.htaccess file. WordPress can overwrite anything between these tags.

More info

# Hide Attachment files in WordPress search result.
Now If you want to hide this pdf from your site search result or some other pdf as well then try this one.

// Exclude attachment from search results - WordPress
add_action( 'init', 'exclude_attachment_from_search_results' );
function exclude_attachment_from_search_results() {
    global $wp_post_types;
    $wp_post_types['attachment']->exclude_from_search = true;
}

This will help you hide all media files in WordPress search result.

# Disallow search engine to index pdf files
Last you have to disallow search engine to not index your sites pdf files.
Paste this code on .httaccess

<Files ~ "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

More Info

Or use this code on your robot.txt

User-agent: *
Disallow: /pdfs/ # Block the /pdfs/directory.
Disallow: *.pdf  # Block pdf files. Non-standard but works for major search engines.

Hope it’s help. and if you still fill confused how to do this then I’m suggest you better take help from someone who can do that for you.