PHP / MySQLi - file_get_contents()超过了Max Allowed Packet

I am trying to upload a file as a Blob from a form into a MySQL database. The problem is that max_allowed_packet is 65536 bytes and if a file is over that size it gets corrupted.

Right now I am doing this to get the file contents, which works:

$certificateWaiverFile = file_get_contents($_FILES['inputCertificateWaiverFile']['tmp_name']);

Then I use send_long_data() to insert it into the db:

$stmt->send_long_data(28, $certificateWaiverFile);

Once it gets to the DB though, it says the blob is 65536 bytes even though it's really 360KB. When I try to download it, it shows up mysteriously as 352KB instead of 65536 bytes.

Any ideas on how I can break up the file to actually get it stored in the DB correctly, assuming I can't adjust max_allowed_packet? Thanks!

I figured out the issue. I was using BLOB instead of MEDIUMBLOB which changes the limit from 64kb to 16mb. Now I know!