fixed validation and generating file link