anshuverma1989 Posted January 13, 2009 Share Posted January 13, 2009 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 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 Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 13, 2009 Share Posted January 13, 2009 what is the php code for the page? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted January 13, 2009 Share Posted January 13, 2009 From the manual http://dev.mysql.com/doc/refman/5.0/en/gone-away.html You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. 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. If you cannot increase the setting, you should remember that - databases are not file storage engines. File systems should be used for storing files. Databases should be used for storing data. Quote Link to comment Share on other sites More sharing options...
anfo Posted January 14, 2009 Share Posted January 14, 2009 check the size of allowed uploads in the php.ini configuration file this might be set too low for your upload. Quote Link to comment Share on other sites More sharing options...
jzdexta Posted January 14, 2009 Share Posted January 14, 2009 The best way out is save the file in a folder and make an entry in the database this will ensure that even if you change servers there wont be a problem with this type of configuration. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.