Hello Daniel,

you said you change all the max_limit stuff in PHP/Apache, but did you
change it on mysql ?

by default the mysql_allowed_package is set to 1M, you have to add a line in
your my.ini file (in my case this is in the windows directory, if you are
using linux search google :))

In the section [mysqld] add

set-variable = max_allowed_packet=10M

or the value you want.
I had a similar problem in a desktop application that inserted images into
the database it gave the erro "mySQL has gone away" and this was the

Hope this Hepls.

----- Original Message -----
From: "Daniel Crespo" <[EMAIL PROTECTED]>
Sent: Wednesday, March 24, 2004 7:19 PM
Subject: [PHP-DB] File upload bug

> Hi all you there...
> I realized that when I try to upload a file of about 1MB or more, it
> upload... Even changing all the max_limit stuff at the config files of
> Apache and PHP... So, I don't now how to solve this.
> In the form, there are:
> <form enctype="multipart/form-data" name="frmUploadFile"
> method="post">
> <input type="text" name="strDesc" size="20" maxlength="50">
> <input type="file" name="fileUpload" size="20">
> </form>
> In upload.php there are:
> <?
> global $strDesc;
> global $fileUpload;
> global $fileUpload_name;
> global $fileUpload_size;
> global $fileUpload_type;
> $fileHandle = fopen($fileUpload, "rb");
> $fileContent = fread($fileHandle, $fileUpload_size);
> $fileContent = addslashes($fileContent);
> $dbQuery = "INSERT INTO myBlobs VALUES ";
> $dbQuery .= "(0, '$strDesc', '$fileContent', '$fileUpload_type')";
> db_query($dbQuery) or die("Couldn't add file to database");
> ?>
> With short files (up to 1MB aprox.), it works just perfect... But, more
> this, the variable $fileUpload_size, for example, is 0 (Zero)... So,
> know how to fix this? Thanks.
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to