Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 632181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:02:54+00:00 2026-05-13T20:02:54+00:00

I have sensitive files to download to users, and each user is permitted to

  • 0

I have sensitive files to download to users, and each user is permitted to download a given file exactly once. If the download fails, I want to permit the re-download, but not otherwise.

It’s not sufficient to rely on logging/processing the file download request at the server – I need to know deterministically when the file is complete and in place at the client, since many of my users work in an environment with frequent connectivity drops.

The most straightforward way for this to work would be if the browser exposed a “file saved” event from the Save As… dialog that could be wired to a JavaScript function on the download page (which could post back to the server). But, intuition suggests there might be security holes if browsers exposed this functionality, as it sneaks somewhat outside the sandbox. I’m not sure this is even possible.

I found several other questions in this area, but nothing about this problem specifically.

Any ideas?

Edit: I should not have used the word “security” in the original question, sorry for triggering the red herrings.

Edit 2: My “security” phrasing misled folks into offtopic technical security issues, but both of you confirmed my suspicion that “no, there’s no browser support for that.” I’m marking the first commenter with the answer since his first sentence had what I was looking for. Thanks all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:02:55+00:00Added an answer on May 13, 2026 at 8:02 pm

    There’s no such browser event in JavaScript and even if there was you can not trust the user’s browser to provide security for you.

    You’re better off using a GUID to generate a unique URL for each download. You can then for example:

    • let the URL be valid only for a specific time period
    • allow transfers only from a specific IP address associated with the unique URL
    • let your server-side code detect when the content for a unique URL has been fully transferred and then invalidate the URL.

    Let me clarify the last bullet. Say you’re using Java – you will in.read(buffer) and out.write(buffer) in a loop until EOF. If the client disconnects you will receive an IOException during out.write() and will be able to tell a successful download from an interrupted one. On other platforms, I’m sure there are ways to tell whether the connection was lost or not.

    EDIT: You could actually fire a browser event using the trick outlined in the accepted answer of one of the questions you linked to. That would however not be a reliable solution to limit the number of downloads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a view that protects certain sensitive files from public download, using nginx'
I have an active project with some sensitive files and directories. I want to
I have some sensitive files that I want the web server to be able
I have to encrypt/decrypt some sensitive information in a Xml file? Yes I can
I have a Lucene index which is currently case sensitive. I want to add
In many applications, we have some progress bar for a file download, for a
I have a winforms application that presently ships with a chm file for context-sensitive
I have a .ini file with sensitive information in my php wab app. I
I have a directory of files that logged-in users can upload to and access.
I will have clients upload pdf files with sensitive information. I'm planning on having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.