Fixing file type not allowed if image is not allowed. And one form lastIndex usage