MySQL

php mysql blob upload download

Using PHP to upload files into MySQL database sometimes needed by
some web application. For instance for storing pdf documents or images
to make som kind of online briefcase (like Yahoo briefcase).

For the first step, let's make the table for the upload files. The table will consist of.

1. id : Unique id for each file
2. name : File name
3. type : File content type
4. size : File size
5. content : The file itself

Got a packet bigger than 'max_allowed_packet' bytes

Got a packet bigger than 'max_allowed_packet' bytes

ref: http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html

this is due to the packet limit of mysql server (have more details
from MySQL documentation:
http://dev.mysql.com/doc/mysql/en/packet-too-large.html ), you can add
extra entry into /etc/my.cnf:

max_allowed_packet = 100M

and restart mysql server on that machine, this will reset the
limitation to 100Mb for file insertion into blob type (or longblob)
column.

Mysql Handbook

mysql

MySQL

mysql

Configuration

configuration

Drupal 4.7 search now requires 'create temporary tables'

Drupal 4.7 now requires 'create temporary tables' priveleges.

mysql> GRANT CREATE TEMPORARY TABLES ON tmp.* TO user@localhost;

More secure work around for limited mysql users (comments section) -
http://dev.mysql.com/doc/refman/4.1/en/privileges-provided.html

Drupal work around for hosts that won't provide 'create temp tables' - ref: http://drupal.org/node/49644

Syndicate content