Hopefully we can roll this out in XenForo 2.2 in full, but for now you can make the following changes.
Firstly please run this SQL query:
ALTER TABLE xf_attachment_data CHANGE file_size file_size bigint NOT NULL;
Then in Entity\AttachmentData.php. Find:
'file_size' => ['type' => self::UINT...