js 方法

String.prototype.endWith = function(endStr){
var d = this.length-endStr.length;
return (d >= 0 && this.lastIndexOf(endStr) == d)
}

验证

var filePath = "123_sign.pdf";
alert(filePath.endWidth("_sign.pdf"));