Hello.
> 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. Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server. See: http://dev.mysql.com/doc/mysql/en/packet-too-large.html Martin Olsson <[EMAIL PROTECTED]> wrote: > 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 > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]