Identify downloard larger than 10MB and routing it to another WAN connection

Am trying to identify downloads (on any port and protocol) greater than 10MB before they start to download.
Then mark the connection and packets and assign a routing mark to route them to a specific WAN interface.

I have tried connection byte 10000000-0 but this breaks connections as they are routed to the new WAN interface
as a result of the new routing mark.

Is there a way of identifying the actual download size of a connection before starting?

If it’s an HTTP connection, you can use a custom web proxy, where you send a HEAD request to the target page, and based on the returned Length header, make the “real” HTTP request from one of two WANs, both of which can be accessed by the web server.

MikroTik’s own web proxy can’t do that though. You’ll have to dst-nat requests to a custom web server, where you have a script that does that check, while also actually passing the HTTP request along to its correct destination and back.

Note also that this approach won’t work for HTTPS.

Thank you for your suggestion but I was hoping to do it on the routerboard without complicating the configuration.

I don’t know of a way to determine in advance the size of a download. What are you actually trying to accomplish?

It is rather impossible.
How to determine what are the total sizes of pictures dynamically loaded from scripted web page ?
How to determine youtube film length ?
What about streaming with unknown time/size ?
etc. etc.