The Content-type MIME header is part of the equation.  You'll also want a
Content-disposition header to specify what the file should be named and a
Content-length header always helps so the browser knows how much data to
download.  You may need to change $mime_type to something other than
text/html if your browser still doesn't prompt you to download.  You WILL
need to re-serve the page in any case.

print "Content-type: $mime_type\n";
print "Content-disposition: filename=$file\n";
print "Content-length: $size\n\n";

Peter Guzis
Web Administrator, Sr.
ENCAD, Inc.
email: [EMAIL PROTECTED]
www.encad.com 

-----Original Message-----
From: Steve Sotis [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 06, 2002 11:19 AM
To: [EMAIL PROTECTED]
Subject: Allowing downloads


I am outputting html pages via perl. I want to put a button on one of these 
pages that, when clicked, pops up a "What would you like to do with this 
file? Open from current location / Save to disk?" dialog box, without 
affecting the contents of the page that the user is already on, i.e. 
without having to re-serve the page.

I know how to do the button stuff, and I know how to output the data 
(non-html), but how do I force the browser to pop up the dialog box without 
affecting the current page? Is it a different "Content-Type" that forces it
up?

Any samples would be appreciated!

Thanks,

Steve 

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to