Re: manage stored files via web

From: apz <apz(at)nofate(dot)com>
To: Victor Yegorov <viy(at)pirmabanka(dot)lv>
Cc: Postgres PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: manage stored files via web
Date: 2003-03-20 14:56:38
Message-ID: Pine.LNX.4.50.0303200950210.24744-100000@binertia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Thu, 20 Mar 2003, Victor Yegorov wrote:
> * 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.
> > 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.

actually I dont really know, i found it somewhere on the net. As I was
working with embedding documents from db (item with item image in db as
well), the content-disposition was actually causing problems for some
browsers as they assumed that although the file is to be embedded <img
src=getImage.php?itemcode=9346a> browsers got confused by the
content-disposition and were assuming that download is necessary. As I
really didnt need to use content-disposition I removed teh code. I know
now that there is also content-disposition inline (vs attachment).

you can read more on content-disposition at:
http://www.php.net/manual/en/function.header.php

/apz, pain, n.: One thing, at least it proves that you're alive!

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Ludwig Lim 2003-03-22 05:01:18 Questions Regarding Sessions
Previous Message Victor Yegorov 2003-03-20 14:30:58 Re: manage stored files via web