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) %>
  <p>
    <label for="storage_name">Name</b><br />
    <%= text_field 'storage' ,'name' %>
  </p>
    <label for="storage_data">File</b><br />
    <%= file_field 'storage' ,'data' %>

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

This is my controller

  def create
    @storage = Storage.new(params[:storage])

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

Do tell me if I am doing anything wrong please.