complete the attachment view function