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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.