From 3d8dc4c1201bde855a08b50cc632dfe90886031a Mon Sep 17 00:00:00 2001 From: Evan Theurer Date: Thu, 6 Nov 2014 17:07:59 +0100 Subject: [PATCH] Clear input type file value for uploaded pictures on cancel. --- static/js/directives/buddypictureupload.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/static/js/directives/buddypictureupload.js b/static/js/directives/buddypictureupload.js index fdd18d0a..e410c91f 100644 --- a/static/js/directives/buddypictureupload.js +++ b/static/js/directives/buddypictureupload.js @@ -124,6 +124,7 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi $scope.imgData = null; $scope.prevImage.src = ""; $scope.prevImage.style.cssText = null; + $scope.clearInput(); }; $scope.cancelPictureUpload = function() { @@ -203,6 +204,9 @@ define(['jquery', 'underscore', 'text!partials/buddypictureupload.html'], functi var link = function($scope, $element) { $scope.prevImage = $element.find("img.preview").get(0); + $scope.clearInput = function() { + $element.find("input[type=file]")[0].value = ""; + }; // Bind change event of file upload form. $element.find("input[type=file]").on("change", $scope.handlePictureUpload);