diff --git a/ignite-html-validate.js b/ignite-html-validate.js
index 7d21ec5..a126fe6 100644
--- a/ignite-html-validate.js
+++ b/ignite-html-validate.js
@@ -173,6 +173,8 @@ IgniteTemplate.prototype.validate = function (callback) {
value = this.element.checked;
} else if (type == "number") {
value = Number(this.element.value);
+ } else if (type == "file") {
+ value = this.element.files;
} else if (this.element.hasAttribute("contenteditable") && this.element.getAttribute("contenteditable").toLowerCase().trim() == "true") {
value = this.element.textContent;
} else {
@@ -327,6 +329,19 @@ IgniteTemplate.prototype.validateMatches = function (compare, msg) {
});
}
+/**
+ * Validates an input to make sure it contains at least one file file.
+ * @param {string|Function|IgniteProperty} msg The message to display when a file has not been selected.
+ * @returns {IgniteTemplate} This ignite template.
+ */
+IgniteTemplate.prototype.validateFile = function(msg) {
+ return this.validate((value, error) => {
+ if (!value || value.length == 0) {
+ return error(msg ? msg : 'Must select a file to upload.');
+ }
+ });
+}
+
/**
* Validates this element and all the children within the element.
* @returns {Boolean} Whether or not this element and all children in this element are valid.