diff --git a/index.html b/index.html
index fa71eb2..c42ecae 100644
--- a/index.html
+++ b/index.html
@@ -33,6 +33,7 @@
+
diff --git a/js/file-change.js b/js/file-change.js
new file mode 100644
index 0000000..1b22359
--- /dev/null
+++ b/js/file-change.js
@@ -0,0 +1,23 @@
+(function() {
+'use strict';
+
+var weechat = angular.module('weechat');
+
+weechat.directive('fileChange', ['$parse', function($parse) {
+
+ return {
+ restrict: 'A',
+ link: function ($scope, element, attrs) {
+ var attrHandler = $parse(attrs.fileChange);
+ var handler = function (e) {
+ $scope.$apply(function () {
+ attrHandler($scope, { $event: e, files: e.target.files });
+ });
+ };
+ element[0].addEventListener('change', handler, false);
+ }
+ };
+
+ }]);
+
+})();