added check for empty file upload