add file type constrains and error handler