public void addUploadedFile ( @ Nonnull @ Nonempty final String sFieldName , @ Nonnull final TemporaryUserDataObject aUDO ) { ValueEnforcer . notEmpty ( sFieldName , "FieldName" ) ; ValueEnforcer . notNull ( aUDO , "UDO" ) ; m_aRWLock . writeLocked ( ( ) -> { // Remove an eventually existing old UDO with the same filename - avoid // bloating the list final TemporaryUserDataObject aOldUDO = m_aMap . remove ( sFieldName ) ; if ( aOldUDO != null ) _deleteUDO ( aOldUDO ) ; // Add the new one m_aMap . put ( sFieldName , aUDO ) ; } ) ; }
Add an uploaded file . Existing UDOs with the same field name are overwritten and the underlying file is deleted . By default an uploaded file is not confirmed and will be deleted when the session expires . By confirming the uploaded image it is safe for later reuse .