Free

Free coded apps to suit all. No sign up, no email, usable offline, updates when I can, feedback welcome. Send feedback

How-to

How to attach pictures or files to database records

Give the table an image or a file attachment field in Base by Zaweba, then add pictures and files to each record from the datasheet's right-click menu.

How to attach pictures or files to database records

Add an image field or a file attachment field to the table. Base by Zaweba has both as field types in the table designer. Once the field is there, right-click the cell in the datasheet to add a picture or a file to that record, and an image control on a form can show the picture as you step through the records.

That puts a photo with each item in a collection, a scan with each receipt, or a contract with each customer, all in one place.

Adding the field

Open the table in the table designer and add a field. Choose image for pictures, and file attachment for documents and anything else. Give it a clear name and, if you like, a caption, which is the text used on labels.

You can have more than one such field on a table, for instance a Photo field and a Certificate field on a members table.

Adding pictures and files to records

In the datasheet, right-click the cell in the image or file column for the record you want, and add the picture or file from the menu. Do the same to replace or remove one later.

Because records save when you leave the row, the attachment is kept as soon as you move on.

Showing pictures on a form

In the form designer, the toolbox includes an image control. Drag the image field from the field list onto the form and the right control arrives with its label. Size it to suit; a thumbnail at the side of a record works well for a stock form or a book catalogue.

Form view then shows each record's picture as you move through with next and previous.

Where the attachments live

Each Base database is a single .obase file, and everything in it lives in that one file. That has a lot going for it: back up or copy the file and the pictures go with it, and there are no broken links to a folder that someone moved.

The flip side is size. Many large photos make a large file. Before adding hundreds of pictures, it is worth reducing photos from a modern phone to a sensible size first. Paint by Zaweba is Zaweba's image editor, if you want a tool for that.

After clearing out a lot of attachments, Database > Compact and repair hands the unused space back and makes the file smaller, after a backup copy.

Uploads through the PHP site

When you export the database as a PHP and MySQL website, image and file fields come along. The site allows uploads with a size limit, and pictures are checked to be real PNG, JPEG, GIF or WebP files rather than something else with a picture's name. That lets people add a photo from their phone when entering a record online.

Good uses

A shop's stock list with a photo of each product. A club's membership records with a photo for each card. A collection catalogue for books, records, stamps or models. An equipment register with the manual and warranty attached to each item. A simple document store for a small office, with one record per letter and the scan attached.

In each case the picture or file sits right beside the facts about it, which is exactly what makes Base by Zaweba handy for this kind of record keeping.