Attempting to Insert File into DB But MYSQL "Goes away"

I am trying to upload a file to the DB but I am apparently unable to do
so for the following reason :

ActiveRecord::StatementInvalid in StoragesController#create

Mysql::Error: MySQL server has gone away: INSERT INTO `storages`
(`content_type`, `name`, `updated_at`, `created_at`, `data`)
VALUES('application/pdf', 'Err', '2008-05-29 01:39:35', '2008-05-29
01:39:35', x'255044462d312e340a25c7ec8fa20a352030206f626a0a....

If I try to upload a file like a pdf or word or excel document it does
not upload. I do get to upload small text files.

This is my view :

<%= error_messages_for :storage %>

<%= form_tag ({:action=>'create'}, :multipart=>true) %>
    <label for="storage_name">Name</b><br />
    <%= text_field 'storage' ,'name' %>
    <label for="storage_data">File</b><br />
    <%= file_field 'storage' ,'data' %>

    <%= submit_tag "Create" %>
<%= form_tag %>

This is my controller

  def create
    @storage =[:storage])

    logger.debug(">>> storage #{}")
        logger.debug(">>> storage #{}")
    @storage.content_type = =
    respond_to do |format|
        flash[:notice] = 'Storage was successfully created.'
        format.html { redirect_to(@storage) }
        format.xml { render :xml => @storage, :status => :created,
:location => @storage }
        format.html { render :action => "new" }
        format.xml { render :xml => @storage.errors, :status =>
:unprocessable_entity }

Do tell me if I am doing anything wrong please.