Page 1 of 1

Problem with uploading to database

Posted: Tue Jan 13, 2009 9:00 am
by anshuverma1989
Hello,

I am facing this problem while uploading a big file to my database.

The problem i am facing is that when i upload a big file like more than 1 MB.. it does not upload the file and shows the following error.

"Failed to execute SQL. Error: MySQL server has gone away"

This is my table structure

Code: Select all

CREATE TABLE tbl_Files (
id_files tinyint(3) unsigned NOT NULL auto_increment,
bin_data longblob NOT NULL, <<< this is where the files gets uploaded
description tinytext NOT NULL,
user_name varchar(50) NOT NULL,
subuser_name varchar(50) NOT NULL,
PRIMARY KEY (id_files)
);
what should i do?

please solve my problem..

thanks and regards,
Anshu

Re: Problem with uploading to database

Posted: Tue Jan 13, 2009 9:21 am
by mattpointblank
First google result for your error is this: http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

One of the points says:
If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by setting the server's max_allowed_packet variable, which has a default value of 1MB. You may also need to increase the maximum packet size on the client end. More information on setting the packet size is given in Section B.1.2.10, “Packet too large”.

Re: Problem with uploading to database

Posted: Tue Jan 13, 2009 9:24 am
by aceconcepts
I typed the error you quoted into Google and voila there is information on this topic.

http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

Try searching for your solution.