pg.ddx.io pgsql-php@postgresql.org mailing list archive
help / color / mirror / Atom feedTutorial/Example of Insert/Select PDF Postgres DB ?
4+ messages / 2 participants
[nested] [flat]
* Tutorial/Example of Insert/Select PDF Postgres DB ?
@ 2006-10-09 04:53 ben wilko <wilko_ben@hotmail.com>
2006-10-09 05:28 ` Re: Tutorial/Example of Insert/Select PDF Postgres DB ? Chris <dmagick@gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: ben wilko @ 2006-10-09 04:53 UTC (permalink / raw)
To: pgsql-php
Hi Guys
I am looking for an examples on how to insert a PDF file into Postgres DB
and also selecting it so that someone can download it from a page.
Thanx
Ben :)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Tutorial/Example of Insert/Select PDF Postgres DB ?
2006-10-09 04:53 Tutorial/Example of Insert/Select PDF Postgres DB ? ben wilko <wilko_ben@hotmail.com>
@ 2006-10-09 05:28 ` Chris <dmagick@gmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: Chris @ 2006-10-09 05:28 UTC (permalink / raw)
To: ben wilko <wilko_ben@hotmail.com>; +Cc: pgsql-php
ben wilko wrote:
> Hi Guys
>
> I am looking for an examples on how to insert a PDF file into Postgres
> DB and also selecting it so that someone can download it from a page.
You would be much better off storing the path to the file (or just the
filename) in the database, leaving the file itself on the filesystem and
password protecting the downloads folder with a .htaccess file or something.
You could then have something like download.php?file=filename.txt and go
from there (it would use fpassthru to just spit the file out to the
browser etc)..
--
Postgresql & php tutorials
http://www.designmagick.com/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Tutorial/Example of Insert/Select PDF Postgres DB ?
@ 2006-10-09 05:51 Chris <dmagick@gmail.com>
2006-10-14 04:57 ` Re: Tutorial/Example of Insert/Select PDF Postgres DB ? ben wilko <wilko_ben@hotmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Chris @ 2006-10-09 05:51 UTC (permalink / raw)
To: ben wilko <wilko_ben@hotmail.com>; +Cc: pgsql-php
Firstly always CC the mailing list.
ben wilko wrote:
> I am looking to have a dynamic page which will allow users to select
> categories in which a corresponding PDF file will be accessible to them.
That doesn't make any difference.. It becomes two database tables:
create table downloadfile (fileid serial primary key, filename text);
create table downloadfile_categories (fileid int references downloadfile
(fileid), categoryid int references categories (categoryid));
then a file can be available for multiple categories and so on.
If you really want to store binary data in the database, start here:
http://www.postgresql.org/docs/8.1/static/datatype-binary.html
and here:
http://php.net/pg_escape_bytea
--
Postgresql & php tutorials
http://www.designmagick.com/
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Tutorial/Example of Insert/Select PDF Postgres DB ?
2006-10-09 05:51 Re: Tutorial/Example of Insert/Select PDF Postgres DB ? Chris <dmagick@gmail.com>
@ 2006-10-14 04:57 ` ben wilko <wilko_ben@hotmail.com>
0 siblings, 0 replies; 4+ messages in thread
From: ben wilko @ 2006-10-14 04:57 UTC (permalink / raw)
To: dmagick@gmail.com; +Cc: pgsql-php
thank you chris for your solution :)
>From: Chris <dmagick@gmail.com>
>To: ben wilko <wilko_ben@hotmail.com>
>CC: pgsql-php@postgresql.org
>Subject: Re: [PHP] Tutorial/Example of Insert/Select PDF Postgres DB ?
>Date: Mon, 09 Oct 2006 15:51:46 +1000
>
>Firstly always CC the mailing list.
>
>ben wilko wrote:
>>I am looking to have a dynamic page which will allow users to select
>>categories in which a corresponding PDF file will be accessible to them.
>
>That doesn't make any difference.. It becomes two database tables:
>
>create table downloadfile (fileid serial primary key, filename text);
>create table downloadfile_categories (fileid int references downloadfile
>(fileid), categoryid int references categories (categoryid));
>
>then a file can be available for multiple categories and so on.
>
>
>If you really want to store binary data in the database, start here:
>
>http://www.postgresql.org/docs/8.1/static/datatype-binary.html
>
>and here:
>
>http://php.net/pg_escape_bytea
>
>--
>Postgresql & php tutorials
>http://www.designmagick.com/
>
>---------------------------(end of broadcast)---------------------------
>TIP 2: Don't 'kill -9' the postmaster
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-10-14 04:57 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-10-09 04:53 Tutorial/Example of Insert/Select PDF Postgres DB ? ben wilko <wilko_ben@hotmail.com>
2006-10-09 05:28 ` Chris <dmagick@gmail.com>
2006-10-09 05:51 Re: Tutorial/Example of Insert/Select PDF Postgres DB ? Chris <dmagick@gmail.com>
2006-10-14 04:57 ` ben wilko <wilko_ben@hotmail.com>
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