[rt-users] how to reduce the limit of attachment

Alex Vandiver alexmv at bestpractical.com
Tue Jul 29 15:42:45 EDT 2014


On 07/29/2014 11:37 AM, Marco Agostini wrote:
> I would like to reduce the maximum size of attachments that can be
> added directly from the web interface.
> 
> I'm using:
> - Debian 7.5
> - mysql 5.5.37-0+wheezy1
> - RT 4.2.5
> 
> I set the value "max_allowed_packet" to "1M" in "/etc/mysql/my.cnf"

You should set it to higher than 1M.  Encoding may extend the size of
the object in the database, and MySQL may simply drop the connection if
it gets too large a packet.  Having dropped mysql connections will abort
the attachment insert _and_ all sorts of other things, none of which are
desirable.

> and configure these parameters on "/opt/rt4/etc/RT_SiteConfig.pm":
> 
> Set($MaxAttachmentSize, 1_000_000);       # 1M
> Set($DropLongAttachments, 1_000_000);     # 1M

$DropLongAttachments is a boolean option:
  http://docs.bestpractical.com/RT_Config#DropLongAttachments

It also only works if $TruncateLongAttachments is not set.

> removed the cache:
> rm -rf /opt/rt4/var/mason_data/obj

For reference, not relevant in this case, as you've not changed any
Mason files.

> and restarted apache
> apache2ctl restart
> 
> 
> ...but I can upload file that is bigger than 1M.

RT will still allow you to _upload_ files larger than 1M, but will
silently drop them when the correspondence is recorded.  There is a
branch in the final stages of review that will add an entry into the
ticket transaction history when an attachment is dropped or truncated.
 - Alex



More information about the rt-users mailing list