[ticket/12755] Terminate upload loop if upload reaches filesize

Terminate the upload loop if the expected filesize has been reached instead
of trying to read more bytes until the timeout has been reached.

PHPBB3-12755