Databases Reference
In-Depth Information
We will see in Chapter 16,
MIME-Based Transformations
that there are special
mechanisms available to go further with
BLOB
fields, including being able to view
some images directly from within phpMyAdmin.
First we add a
BLOB
ield,
cover_photo
, to our
topics
table:
If we now browse the table, we can see the field length information,
[BLOB - 0
Bytes]
,
for each
BLOB
field:
This is because the
$cfg['ShowBlob']
configuration directive is set to
FALSE
by
default, thus blocking the display of
BLOB
contents in Browse and Edit modes
(and showing a
Binary - do not edit
warning). This behavior is intentional - usually
we cannot do anything with binary data represented in plain text.
Binary Contents Uploads
If we now edit one row, we see the warning and a
Browse…
button. The exact
caption on this button depends on the browser. Even though editing is not allowed,
we can easily upload a text or binary file's contents into this
BLOB
column.
Let's choose an image file using the
Browse
button - for example, the
logo_left.png
file in a test copy of the
phpMyAdmin/themes/original/img
directory located on our
client workstation - and click
Go
:
We need to keep in mind some limits for the upload size. Firstly, the
BLOB
field size
is limited to 64K, so phpMyAdmin reminds us of this limit with the
Max: 65,536 Bytes
warning. Also, there could be limits inherent to PHP itself - see Chapter 8,
Importing
Structure and Data
- which would be also taken into account in this maximum size
value. We have now uploaded an image inside this field for a specific row:
Search WWH ::
Custom Search