SPUG: HTTP Headers

Parr, Ryan Ryan.Parr at wwireless.com
Tue Dec 11 13:04:31 CST 2001

Thanks everyone for the suggestions. After testing them all here's what I've
come up with:

** Disclaimer **
The following results are only my experience. Similarities between these
results and the results of others, living or dead, are merely coincidence.
Your results may vary.

Tacking on the filename as JP suggested (loadpage.cgi/filename.doc?id=xxx)
works. The 
Open/Save dialog reports the '?id=xxx' portion, but it is removed when saved
or opened, unless it's inlined and then saved.

Tacking on the filename at the end of the URL per BR's suggestion works for
the Open/Save dialog, however the actual opened or saved document is named
the cgi. I.E. loadpage.doc.

BT's suggestion of using Content-disposition: attachment;
filename=filename.doc works for when the file is opened, but the Open/Save
dialog is the URL.

Combining <url><?parms>/<filename> with the "Content-disposition:" HTTP
headers will take care of any end-user confusion, and all methods are logged
for future solutions.

Thanks again for all your help!

-- Ryan Parr

-----Original Message-----
From: El JoPe Magnifico [mailto:jope-spug at jope.net]
Sent: Tuesday, December 11, 2001 10:49 AM
To: Parr, Ryan
Cc: Seattle Perl Users Group
Subject: Re: SPUG: HTTP Headers

In the past, I've tacked on the suggested filename as (or at the end of)
the PATH_INFO part of the URL, after the CGI script name, e.g.
Works on Apache, dunno about other servers.  Remember to URI-escape the
filename first, to account for whitespace, etc.

On Tue, 11 Dec 2001, Parr, Ryan wrote:
> I'm currently moving the intranet site I work on to be completely database
> based. However, I'm running into a snag with delivering documents to the
> user. Rather, delivering documents other than HTML to the user.
> If I have my CGI load a word doc that's stored in the database, and send
> to the user with the appropriate mime type, the browser can handle it
> appropriately. Unfortunately though, I have no way to specify a filename
> the content. So instead of receiving an Open/Save dialog for CMS_SOP.doc
> they receive an Open/Save dialog for /cgi-bin/loadpage.cgi?id=334, or the
> browser loads the word doc with the filename /cgi-bin/loadpage.cgi?id=334.
> I haven't been able to find any standard HTTP headers that deal with this
> scenario, nor any IE specific extension headers. I'm in a controlled
> environment so everyone has IE 4+. This approach to document delivery
> natural enough to me that I'm sure a thousand developers before me have
> attempted it, certainly some with success. Have any of you?

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/

More information about the spug-list mailing list