Jump to content

Problem with uploading to database


anshuverma1989

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/140678-problem-with-uploading-to-database/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.