fix bugs in validation of uploaded data
add file attachment upload feature