Forcing the downloading of a file

R

Rogue Chameleon

Hi all

I apologize for the vagueness of the subject line... but it's the best that
I could do. Here is what I am trying to accomplish:

Our users will be receiving automated emails from a web server that will
contain an encrypted file attachment. The file has been encrypted with a
public key. For the file to be useful, it will obviously need to be
decrypted.

What I'd like to do is have a web servlet do the encryption for the users.
Once they get the email, they detach the file, and upload it to the servlet
(using <input type="file">), the decryption will occur. Immediately after
the decryption, I want to "force" the file back to the user. That is, I
want them to be immediately presented with the "download file" dialog box.

Can this be done? If so.... how?
 
M

Michael Borgwardt

Rogue said:
Our users will be receiving automated emails from a web server that will
contain an encrypted file attachment. The file has been encrypted with a
public key. For the file to be useful, it will obviously need to be
decrypted.

What I'd like to do is have a web servlet do the encryption for the users.
Once they get the email, they detach the file, and upload it to the servlet
(using <input type="file">), the decryption will occur.

Using HTTPS, I hope. Otherwise it's rather pointless to encrypt the file
in the first place. And where is the passphrase going to be entered?

But if they're going to decrypt it that way anyway, why not just send them
a link and deliver the file directly via the servlet?
Immediately after
the decryption, I want to "force" the file back to the user. That is, I
want them to be immediately presented with the "download file" dialog box.

Can this be done? If so.... how?

Just have the servlet declare the a MIME type of application/octet-stream
for its response and send the file.
 
R

Rogue Chameleon

Michael Borgwardt said:
Just have the servlet declare the a MIME type of application/octet-stream
for its response and send the file.

Send the file.... how? If I have the file within a File object, should I
just send it out in a ServletOutputStream?
 
R

Rogue Chameleon

Michael Borgwardt said:
Just have the servlet declare the a MIME type of application/octet-stream
for its response and send the file.

Send the file.... how? If I have the file within a File object, should I
just send it out in a ServletOutputStream?
 
T

Tor Iver Wilhelmsen

Rogue Chameleon said:
Send the file.... how? If I have the file within a File object, should I
just send it out in a ServletOutputStream?

No, you need to read the contents and send that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top