added check for undefined response when attempting to upload file to non-whitelisted folder