Unfortunately, PHP doesn't work that way. You need to allocate enough memory to your scripts in the PHP.INI script so that these kinds of things don't happen. There isn't a way to "prequalify" a file before it is sent to the server for processing to catch something like this before it happens.
Please do not PM me for support or sales questions. Thank you for your understanding.