[ticket/12755] Add timeout to remote upload to prevent infinite loop

Ticket: https://tracker.phpbb.com/browse/PHPBB3-12755
while ((!$length || $filesize < $length) && !@feof($fsock)))