From viy@pirmabanka.lv Thu Mar 20 10:45:51 2003 X-Original-To: pgsql-php@postgresql.org Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id 1E7B9475B99 for ; Thu, 20 Mar 2003 05:45:51 -0500 (EST) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.12.8/8.9.3) with SMTP id h2KAjqtw019292 for ; Thu, 20 Mar 2003 12:45:52 +0200 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Thu, 20 Mar 2003 12:45:52 +0200 (EET) Received: from pc311x1.pirmabanka.lv (localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.6/8.11.6) with SMTP id h2KAjpL04878 for ; Thu, 20 Mar 2003 12:45:51 +0200 Received: (qmail 16526 invoked by uid 100); 20 Mar 2003 10:46:45 -0000 Date: Thu, 20 Mar 2003 12:46:45 +0200 From: "Victor Yegorov" To: "Postgres PHP" Subject: manage stored files via web Message-ID: <20030320104645.GA16456@pirmabanka.lv> Mail-Followup-To: "Postgres PHP" Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline User-Agent: Mutt/1.4i X-Archive-Number: 200303/22 X-Sequence-Number: 1934 --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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=3D&actio= n=3Dget" 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. --=20 Victor Yegorov --IJpNTDwzlM2Ie8A6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+eZwV2RKGLEykUDYRAiaVAKCVfgXRdojKuhg2c1XBPjROcV924gCdFWip o6RQqvJI+kR7wLOYnIUK2Q8= =PLas -----END PGP SIGNATURE----- --IJpNTDwzlM2Ie8A6-- From granth@fusion-advertising.co.uk Thu Mar 20 10:53:14 2003 X-Original-To: pgsql-php@postgresql.org Received: from server1.fusion-advertising.co.uk (host217-35-101-159.in-addr.btopenworld.com [217.35.101.159]) by postgresql.org (Postfix) with ESMTP id 741A6475EA4 for ; Thu, 20 Mar 2003 05:53:14 -0500 (EST) Subject: Re: manage stored files via web Date: Thu, 20 Mar 2003 10:53:12 -0000 Message-ID: <31EA81C61A3D014F8D6933864F32C604049D25@server1.fusion-advertising.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PHP] manage stored files via web X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Thread-Index: AcLuznZanW6m0J8IQbKgE0oax15hEQAACdYQ content-class: urn:content-classes:message From: "Grant Henderson" To: "Postgres PHP" X-Archive-Number: 200303/23 X-Sequence-Number: 1935 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 . G -----Original Message----- From: Victor Yegorov [mailto:viy@pirmabanka.lv]=20 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=3D&action=3Dget" 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. --=20 Victor Yegorov From viy@pirmabanka.lv Thu Mar 20 11:02:48 2003 X-Original-To: pgsql-php@postgresql.org Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id 6ED23475B99 for ; Thu, 20 Mar 2003 06:02:48 -0500 (EST) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.12.8/8.9.3) with SMTP id h2KB2ntw019488 for ; Thu, 20 Mar 2003 13:02:49 +0200 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Thu, 20 Mar 2003 13:02:48 +0200 (EET) Received: from pc311x1.pirmabanka.lv (localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.6/8.11.6) with SMTP id h2KB2mn06364 for ; Thu, 20 Mar 2003 13:02:48 +0200 Received: (qmail 16577 invoked by uid 100); 20 Mar 2003 11:03:42 -0000 Date: Thu, 20 Mar 2003 13:03:42 +0200 From: "Victor Yegorov" To: "Grant Henderson" Cc: "Postgres PHP" Subject: Re: manage stored files via web Message-ID: <20030320110342.GC16456@pirmabanka.lv> Mail-Followup-To: "Grant Henderson" , "Postgres PHP" References: <31EA81C61A3D014F8D6933864F32C604049D25@server1.fusion-advertising.co.uk> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WplhKdTI2c8ulnbP" Content-Disposition: inline In-Reply-To: <31EA81C61A3D014F8D6933864F32C604049D25@server1.fusion-advertising.co.uk> User-Agent: Mutt/1.4i X-Archive-Number: 200303/24 X-Sequence-Number: 1936 --WplhKdTI2c8ulnbP Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Grant Henderson [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 . >=20 I'm saving them not directly on my disk, I store them inside my POstgreSQL database as Large Object. --=20 Victor Yegorov --WplhKdTI2c8ulnbP Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+eaAO2RKGLEykUDYRAs0zAJ4qJTwcdINyxgq5guhZ2JgwU2FPrgCgwjBo 6VMSSYMUKPkYfspIxVAsvv4= =n8X5 -----END PGP SIGNATURE----- --WplhKdTI2c8ulnbP-- From viy@pirmabanka.lv Thu Mar 20 13:28:10 2003 X-Original-To: pgsql-php@postgresql.org Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id BCDB2475C3D for ; Thu, 20 Mar 2003 08:28:10 -0500 (EST) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.12.8/8.9.3) with SMTP id h2KDSCtw021272 for ; Thu, 20 Mar 2003 15:28:13 +0200 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Thu, 20 Mar 2003 15:28:12 +0200 (EET) Received: from pc311x1.pirmabanka.lv (localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.6/8.11.6) with SMTP id h2KDSBF19347 for ; Thu, 20 Mar 2003 15:28:11 +0200 Received: (qmail 16717 invoked by uid 100); 20 Mar 2003 13:29:05 -0000 Date: Thu, 20 Mar 2003 15:29:05 +0200 From: Victor Yegorov To: Matt Palmer Cc: "Postgres PHP" Subject: Re: manage stored files via web Message-ID: <20030320132905.GD16456@pirmabanka.lv> Mail-Followup-To: Matt Palmer , "Postgres PHP" References: <31EA81C61A3D014F8D6933864F32C604049D25@server1.fusion-advertising.co.uk> <20030320110342.GC16456@pirmabanka.lv> <1048159438.3e79a4ce10c1e@cobalt3.abcholidayplus.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VMt1DrMGOVs3KQwf" Content-Disposition: inline In-Reply-To: <1048159438.3e79a4ce10c1e@cobalt3.abcholidayplus.de> User-Agent: Mutt/1.4i X-Archive-Number: 200303/25 X-Sequence-Number: 1937 --VMt1DrMGOVs3KQwf Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Matt Palmer [20.03.2003 13:18]: > are the jpegs only memory-resident or are they actually on-disk at any po= int?? 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? --=20 Victor Yegorov --VMt1DrMGOVs3KQwf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+ecIh2RKGLEykUDYRArMEAKCpnim1Z86Yx9i+mMJbNr3RjnsHsQCfQ1gy izvw7V3OpV+0WXIXtlBbkrY= =MbhL -----END PGP SIGNATURE----- --VMt1DrMGOVs3KQwf-- From apz@nofate.com Thu Mar 20 13:34:28 2003 X-Original-To: pgsql-php@postgresql.org Received: from alegro.binertia.com (unknown [216.254.174.62]) by postgresql.org (Postfix) with ESMTP id B94FA4762D7 for ; Thu, 20 Mar 2003 08:34:28 -0500 (EST) Received: by alegro.binertia.com (Postfix, from userid 506) id 6BCA3C824A; Thu, 20 Mar 2003 08:41:43 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by alegro.binertia.com (Postfix) with ESMTP id 5FB4B19C206; Thu, 20 Mar 2003 08:41:43 -0500 (EST) Date: Thu, 20 Mar 2003 08:41:43 -0500 (EST) From: apz X-X-Sender: apz@binertia.com To: Victor Yegorov Cc: Postgres PHP Subject: Re: manage stored files via web In-Reply-To: <20030320104645.GA16456@pirmabanka.lv> Message-ID: References: <20030320104645.GA16456@pirmabanka.lv> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200303/26 X-Sequence-Number: 1938 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. From viy@pirmabanka.lv Thu Mar 20 14:30:05 2003 X-Original-To: pgsql-php@postgresql.org Received: from shield.pirmabanka.lv (unknown [195.114.57.4]) by postgresql.org (Postfix) with ESMTP id C2F9947633C for ; Thu, 20 Mar 2003 09:30:05 -0500 (EST) Received: from wall2.pirmabanka.lv (wall2-pub.pirmabanka.lv [195.114.57.14]) by shield.pirmabanka.lv (8.12.8/8.9.3) with SMTP id h2KEU5tw022188 for ; Thu, 20 Mar 2003 16:30:05 +0200 Received: from share.pirmabanka.lv ([10.0.0.10]) by wall2.pirmabanka.lv; Thu, 20 Mar 2003 16:30:04 +0200 (EET) Received: from pc311x1.pirmabanka.lv (localhost.localdomain [127.0.0.1]) by pirmabanka.lv (8.11.6/8.11.6) with SMTP id h2KEU4q25613 for ; Thu, 20 Mar 2003 16:30:04 +0200 Received: (qmail 16879 invoked by uid 100); 20 Mar 2003 14:30:58 -0000 Date: Thu, 20 Mar 2003 16:30:58 +0200 From: Victor Yegorov To: apz Cc: Postgres PHP Subject: Re: manage stored files via web Message-ID: <20030320143058.GE16456@pirmabanka.lv> Mail-Followup-To: apz , Postgres PHP References: <20030320104645.GA16456@pirmabanka.lv> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k3qmt+ucFURmlhDS" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Archive-Number: 200303/27 X-Sequence-Number: 1939 --k3qmt+ucFURmlhDS Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * apz [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, st= ored > > in DB. I currently enclose it in Content-type: HTTP header, but that se= ems > > to be not working. >=20 > content-type, as name sais, is to suggest a 'type' of the file, should=20 > browser try to show the file (in case its plaintext/html) or should it=20 > call a plugin (ms word =3D "application/msword"). >=20 > What you want is you want to suggest that=20 > 1. browser saves the file > 2. browser use different name than the url one. >=20 > for this purpose you got in header option to do "Content-Disposition".=20 > Here I must warn you that IE expects Content-Disposition handled=20 > differently than other browsers. Here is what I used to do: >=20 > ---- > $myfakefilename =3D readFileName_FromDB(); > if (strstr($_SERVER["HTTP_USER_AGENT"], "MSIE")) // For IE > header("Content-Disposition: filename=3D$myfakefilename" . "%20");=20 > else // For Other browsers > header("Content-Disposition: attachment; filename=3D$myfakefilename");= =20 > ---- 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. --=20 Victor Yegorov --k3qmt+ucFURmlhDS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE+edCi2RKGLEykUDYRAtSIAJ9M+630Bd11gv6PfXpk0IZJrSX9uwCg1wL8 VaBUrF62cFIZ4OtLsaEtN8c= =R+Ge -----END PGP SIGNATURE----- --k3qmt+ucFURmlhDS-- From apz@nofate.com Thu Mar 20 14:49:23 2003 X-Original-To: pgsql-php@postgresql.org Received: from alegro.binertia.com (unknown [216.254.174.62]) by postgresql.org (Postfix) with ESMTP id 4BCC8475C3D for ; Thu, 20 Mar 2003 09:49:23 -0500 (EST) Received: by alegro.binertia.com (Postfix, from userid 506) id DBADCC824A; Thu, 20 Mar 2003 09:56:38 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by alegro.binertia.com (Postfix) with ESMTP id CF53319C206; Thu, 20 Mar 2003 09:56:38 -0500 (EST) Date: Thu, 20 Mar 2003 09:56:38 -0500 (EST) From: apz X-X-Sender: apz@binertia.com To: Victor Yegorov Cc: Postgres PHP Subject: Re: manage stored files via web In-Reply-To: <20030320143058.GE16456@pirmabanka.lv> Message-ID: References: <20030320104645.GA16456@pirmabanka.lv> <20030320143058.GE16456@pirmabanka.lv> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200303/28 X-Sequence-Number: 1940 On Thu, 20 Mar 2003, Victor Yegorov wrote: > * apz [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 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!