[ticket/11586] Some cleanup of upload_attachment().

http://tracker.phpbb.com/browse/PHPBB3-11586