Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

Suggesting a filename to client browser.

I'm developing a cgi application which offers many files for download - each with a unique password.  I use the following logic:

1) Client requests file.
2) Return HTML form requesting the password.
3) Upon verifying the password, send the file.

When I return the file, I send in the HTTP header:

Content-Type: application/octet-stream

Everything works fine except...

My Question: How can I suggest a filename to the browser instead of having the browser derive one from the original url (ie. the name of the script)?
0
mrmick
Asked:
mrmick
  • 5
  • 2
1 Solution
 
mrmickAuthor Commented:
Edited text of question
0
 
VoodooCommented:
You add an extra header, in addition to your content type:

print "Content-type: application/octet-stream\n";
print "Content-Disposition: inline; filename=$filename\n\n";

This will do it.
0
 
mrmickAuthor Commented:
Voodoo,

1) Excellent for Netscape, any way to get the same results with MSIE?

2) Do you happen to know the RFC for the version of HTTP with this specification? (I have copies of 0.9, 1.0 & 1.1 only)

0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
mrmickAuthor Commented:
Voodoo,

Please do not answer the second question if it requires you to do any research at all; I'm only seeking the RFC if you happen to have the number handy.

I am hoping to find a way to get the same results with MSIE though, but regardless of what else you may have to offer - I'll still consider this question successfully answered.

mrmick

0
 
VoodooCommented:
I don't have the exact number, but you may be able to find it at the following URL:

http://www.oac.uci.edu/indiv/ehood/MIME/MIME.html

Hope this helps...

0
 
mrmickAuthor Commented:
Do you have any idea how I can suggest a filename to MSIE?

I'll go ahead and grade the answer if you'd like, but I'd prefer to wait if you think you might come up with something.

mrmick
0
 
mrmickAuthor Commented:
Ok, well thanks for what you were able to provide.  I'm still looking for a solution to this issue in regard to MSIE.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now