WordPress checks the PHP setting upload_max_filesize before writing a file. If the file size is larger than the value, PHP stops the request and returns an error.
The same check applies to post_max_size and memory_limit. When any of these limits are lower than the file, the upload aborts and WordPress shows the error banner.