12

I'm using file uploading for images into a BLOB in a MySQL database, for some reason when I upload some pictures I noticed they weren't completely rendered, I then tried uploading directly into PHPMyAdmin when it then showed (Max: 64KiB) I luckily enough run my own server so I thought to go check my php.ini for max file upload size, it's set to 250MB. So my question is,

Where is the max filesize for MySQL BLOB Uploads??

Ariana
  • 745
  • 3
  • 9
  • 15

1 Answers1

21

It depends on the type of your column.

From MySQL documentation:, section Storage Requirements for String Types:

TINYBLOB

L+1 bytes, where L < 28 (256 bytes)

BLOB

L+2 bytes, where L < 216 (65 kilobytes)

MEDIUMBLOB

L+3 bytes, where L < 224 (16 megabytes)

LONGBLOB

L+4 bytes, where L < 232 (4 gigabytes)

Community
  • 1
  • 1
Maen
  • 10,603
  • 3
  • 45
  • 71
  • Ah wow I didn't even realize that the type was the issue. I thank you good sir :) – Ariana Nov 13 '13 at 01:37
  • 1
    @Ariana You're welcome! Don't forget to adapt your maximum upload size accordingly though ;) – Maen Nov 13 '13 at 01:39
  • I'm using blob to keep images, but Mediumblob is large type data, there isn't a Blob with 8 or 4 megabytes. Or if I use mediumblob and save an image of 4MB, others 12MB it lose? – CampDev Jul 12 '17 at 19:48
  • 2
    @CampDev You can store up to 16MB : the space isn't allocated until you store something, you won't have 12MB locked and lost if you save a 4MB pic. – Maen Jul 13 '17 at 09:48