pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Victor Yegorov <viy@pirmabanka.lv>
To: apz <apz@nofate.com>
Cc: Postgres PHP <pgsql-php@postgresql.org>
Subject: Re: manage stored files via web
Date: Thu, 20 Mar 2003 16:30:58 +0200
Message-ID: <20030320143058.GE16456@pirmabanka.lv> (raw)
In-Reply-To: <Pine.LNX.4.50.0303200836001.24093-100000@binertia.com>
References: <20030320104645.GA16456@pirmabanka.lv>
	<Pine.LNX.4.50.0303200836001.24093-100000@binertia.com>

* apz <apz@nofate.com> [20.03.2003 15:37]:
> On Thu, 20 Mar 2003, Victor Yegorov wrote:
> > What I want is that file name suggested by browser would be the one, stored
> > in DB. I currently enclose it in Content-type: HTTP header, but that seems
> > to be not working.
> 
> content-type, as name sais, is to suggest a 'type' of the file, should 
> browser try to show the file (in case its plaintext/html) or should it 
> call a plugin (ms word = "application/msword").
> 
> What you want is you want to suggest that 
> 1. browser saves the file
> 2. browser use different name than the url one.
> 
> for this purpose you got in header option to do "Content-Disposition". 
> Here I must warn you that IE expects Content-Disposition handled 
> differently than other browsers. Here is what I used to do:
> 
> ----
> $myfakefilename = readFileName_FromDB();
> if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE"))             // For IE
>    header("Content-Disposition: filename=$myfakefilename" . "%20"); 
> else                                             // For Other browsers
>    header("Content-Disposition: attachment; filename=$myfakefilename"); 
> ----

Great, exactly what I needed.

One question - what for is "%20"? Explorer adds "[1]" suffix, when this
space present. I've removed it.


Thank you.

-- 

Victor Yegorov

view thread (7+ messages)  latest in thread

Message-ID: <20030320143058.GE16456@pirmabanka.lv>
Permalink:  ../20030320143058.GE16456@pirmabanka.lv/
Also on:    postgresql.org/message-id/20030320143058.GE16456@pirmabanka.lv

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: viy@pirmabanka.lv, apz@nofate.com
  Subject: Re: manage stored files via web
  In-Reply-To: <20030320143058.GE16456@pirmabanka.lv>
  References: <20030320104645.GA16456@pirmabanka.lv> <Pine.LNX.4.50.0303200836001.24093-100000@binertia.com> <20030320143058.GE16456@pirmabanka.lv>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox