the default 5MB limit for a file document is only checked when using the file upload control. If you use a webservice or another mechanism the file size isn't checked by mendix.
If you are running in the mendix cloud : This seems to be a configuration thing for the nginx webserver, mendix needs to change the clientmaxbody_size property i think?
Note that sending a file trough a webservice request will cause it to be base64encoded, which means that the actual amount of data to be transferred is 4 times larger than the original size of the file. So your 2.5 mb file needs a maxbody size of 10mb in your nginx environment.
(In other words: Sending filedocs via webservices is very inefficient and CPU intensive)