Skip site navigation (1) Skip section navigation (2)

Re: manage stored files via web

From: Victor Yegorov <viy(at)pirmabanka(dot)lv>
To: apz <apz(at)nofate(dot)com>
Cc: Postgres PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: manage stored files via web
Date: 2003-03-20 14:30:58
Message-ID: 20030320143058.GE16456@pirmabanka.lv (view raw or flat)
Thread:
Lists: pgsql-php
* apz <apz(at)nofate(dot)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

In response to

Responses

pgsql-php by date

Next:From: apzDate: 2003-03-20 14:56:38
Subject: Re: manage stored files via web
Previous:From: apzDate: 2003-03-20 13:41:43
Subject: Re: manage stored files via web

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group