Hi MySQL ppl,
I recently ran into some problems with uploading large files through a HTML form and then putting these files into a MySQL BLOB field. I read about the server parameter max_allowed_packet which turned out to be the problem.
My script is going to be redistributed to it needs to run smoothly on many different servers. Therefore I'm now looking into ways of avoiding this problem, and I also want to avoid forcing the script users to reconfigure his MySQL server.
Now, my questions are:
Q1. Can I divide my query into several packets and thus insert the large BLOB without exceeding the max_allowed_packet limit?
Q2. I doodled around a little bit with the SET command and I was able to change the session version of the max_allowed_packet server parameter. The insert query still failed though, even if I did successfully execute the SET max_allowed_packet=16MB query and also double checked it with an extra select afterwards; and it had indeed changed. See the code below. The question is, is this is viable method? Is the local/session version of this variable just ignored by the server?
My code (for Q2):
$result = mysql_query("SELECT @@local.max_allowed_packet AS max_allowed_packet;");
$row = mysql_fetch_assoc($result);
echo "max_allowed_packet=" . $row['max_allowed_packet'] . "\n";
$result = mysql_query("SET @@local.max_allowed_packet=16000000;");
if (!$result) {
echo "It did not work. " . mysql_errno() . ": " . mysql_error() . "\n";
}$result = mysql_query("SELECT @@local.max_allowed_packet AS max_allowed_packet;");
$row = mysql_fetch_assoc($result);
echo "max_allowed_packet=" . $row['max_allowed_packet'] . "\n";
mvh martin
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
