12.5. An Example of a Simple Image Management Tool

In this section you will see a simplified example of a file management tool that works with images. The basic features have been implemented. The idea is to show you how data can be extracted to the database and how it can be sent to the browser directly. Keep in mind that this is a prototype application.

First, a table for storing information about the pics must be generated:

CREATE TABLE pic_db (
        id serial,              -- id of pic
        name text,              -- name of the pic
        picoid oid,             -- object id of pic
        added timestamp DEFAULT now()
);

The next listing contains a piece of HTML code you can use for uploading files:

 <html> <head> <title>Title</title> </head> <body> <?php echo "<b>List of pictures in the table</b><br>\n"; ...

Get PHP and PostgreSQL: Advanced Web Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.