pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
manage stored files via web
7+ messages / 3 participants
[nested] [flat]

* manage stored files via web
@ 2003-03-20 10:46 Victor Yegorov <viy@pirmabanka.lv>
  2003-03-20 13:41 ` Re: manage stored files via web apz <apz@nofate.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Victor Yegorov @ 2003-03-20 10:46 UTC (permalink / raw)
  To: pgsql-php

Hello.

Sorry for off-topic, but...

I have the following problem. I'm developing system with ability to store
files inside it. Files are being stored in postgres as large objects.

The problem is, that actual file names are stored along with LO oids. When
user wants to download some file, it clicks on link: "...?oid=<oid>&action=get"
and browser suggests strange name for file being downloaded (currently it
suggests domain name or link text as file name).

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.


Thanks in advance.

-- 

Victor Yegorov

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: manage stored files via web
  2003-03-20 10:46 manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
@ 2003-03-20 13:41 ` apz <apz@nofate.com>
  2003-03-20 14:30   ` Re: manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
  0 siblings, 1 reply; 7+ messages in thread

From: apz @ 2003-03-20 13:41 UTC (permalink / raw)
  To: Victor Yegorov <viy@pirmabanka.lv>; +Cc: pgsql-php

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"); 
----

enjoy, 


/apz,   Sometimes you get an almost irresistible urge to go on living.




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: manage stored files via web
  2003-03-20 10:46 manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
  2003-03-20 13:41 ` Re: manage stored files via web apz <apz@nofate.com>
@ 2003-03-20 14:30   ` Victor Yegorov <viy@pirmabanka.lv>
  2003-03-20 14:56     ` Re: manage stored files via web apz <apz@nofate.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Victor Yegorov @ 2003-03-20 14:30 UTC (permalink / raw)
  To: apz <apz@nofate.com>; +Cc: pgsql-php

* 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

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: manage stored files via web
  2003-03-20 10:46 manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
  2003-03-20 13:41 ` Re: manage stored files via web apz <apz@nofate.com>
  2003-03-20 14:30   ` Re: manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
@ 2003-03-20 14:56     ` apz <apz@nofate.com>
  0 siblings, 0 replies; 7+ messages in thread

From: apz @ 2003-03-20 14:56 UTC (permalink / raw)
  To: Victor Yegorov <viy@pirmabanka.lv>; +Cc: pgsql-php

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




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: manage stored files via web
@ 2003-03-20 10:53 Grant Henderson <granth@fusion-advertising.co.uk>
  2003-03-20 11:03 ` Re: manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
  0 siblings, 1 reply; 7+ messages in thread

From: Grant Henderson @ 2003-03-20 10:53 UTC (permalink / raw)
  To: pgsql-php

It would be better if you haven't gone to far already to save the files
into an level above the web directory and simply save the link to the
file into a varchar in the DB.
Then just call the link into an <a href="">.

G

-----Original Message-----
From: Victor Yegorov [mailto:viy@pirmabanka.lv] 
Sent: 20 March 2003 10:47
To: Postgres PHP
Subject: [PHP] manage stored files via web


Hello.

Sorry for off-topic, but...

I have the following problem. I'm developing system with ability to
store files inside it. Files are being stored in postgres as large
objects.

The problem is, that actual file names are stored along with LO oids.
When user wants to download some file, it clicks on link:
"...?oid=<oid>&action=get" and browser suggests strange name for file
being downloaded (currently it suggests domain name or link text as file
name).

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.


Thanks in advance.

-- 

Victor Yegorov



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: manage stored files via web
  2003-03-20 10:53 Re: manage stored files via web Grant Henderson <granth@fusion-advertising.co.uk>
@ 2003-03-20 11:03 ` Victor Yegorov <viy@pirmabanka.lv>
  2003-03-20 13:29   ` Re: manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
  0 siblings, 1 reply; 7+ messages in thread

From: Victor Yegorov @ 2003-03-20 11:03 UTC (permalink / raw)
  To: Grant Henderson <granth@fusion-advertising.co.uk>; +Cc: pgsql-php

* Grant Henderson <granth@fusion-advertising.co.uk> [20.03.2003 12:58]:
> It would be better if you haven't gone to far already to save the files
> into an level above the web directory and simply save the link to the
> file into a varchar in the DB.
> Then just call the link into an <a href="">.
> 

I'm saving them not directly on my disk, I store them inside my POstgreSQL
database as Large Object.

-- 

Victor Yegorov

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: manage stored files via web
  2003-03-20 10:53 Re: manage stored files via web Grant Henderson <granth@fusion-advertising.co.uk>
  2003-03-20 11:03 ` Re: manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
@ 2003-03-20 13:29   ` Victor Yegorov <viy@pirmabanka.lv>
  0 siblings, 0 replies; 7+ messages in thread

From: Victor Yegorov @ 2003-03-20 13:29 UTC (permalink / raw)
  To: Matt Palmer <matthew.palmer@abcmail.co.uk>; +Cc: pgsql-php

* Matt Palmer <matthew.palmer@abcmail.co.uk> [20.03.2003 13:18]:
> are the jpegs only memory-resident or are they actually on-disk at any point??

Nor memory resident, neither on disk. They are inside DB, to extract them i
need to use pg_lo_open, pg_lo_read funcs. Then I have a string, containing
file data. And I don't want to store them on disk, I'd like to output them
directly, specifing the name of the file somehow.

But how?

-- 

Victor Yegorov

^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2003-03-20 14:56 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-03-20 10:46 manage stored files via web Victor Yegorov <viy@pirmabanka.lv>
2003-03-20 13:41 ` apz <apz@nofate.com>
2003-03-20 14:30   ` Victor Yegorov <viy@pirmabanka.lv>
2003-03-20 14:56     ` apz <apz@nofate.com>
2003-03-20 10:53 Re: manage stored files via web Grant Henderson <granth@fusion-advertising.co.uk>
2003-03-20 11:03 ` Victor Yegorov <viy@pirmabanka.lv>
2003-03-20 13:29   ` Victor Yegorov <viy@pirmabanka.lv>

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