Forum: Ruby on Rails attachment_fu and mysql (server has gone away)

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
39a8b48aca70346605c630851d1aee3a?d=identicon&s=25 Luca Roma (romaluca)
on 2008-12-29 19:03
I have a problem with my hosting "hostgator"

In my site i have a section for photos upload.
For manage it i use attachment_fu.
In the action of upload i do some simple query.

If the file to upload is smaller than 1mb there isnt any problem

but if it is bigger than 1 mb about i receive an error:

mysql error server has gone away.

i wrote to hostgator. they responsed me with:

All MySQL connections open for more than 15 seconds are killed off once
a minute.  Your script needs to be modified so the MySQL connection is
opened just prior to the query actually being run


How i can to open mysql connection only when i do query for this action?
thanks
This topic is locked and can not be replied to.