From 386c0f4bc68b05157cb3ee80872ea6daa26478ad Mon Sep 17 00:00:00 2001 From: Jon Bergli Heier Date: Fri, 6 Dec 2019 21:21:50 +0100 Subject: Change bootstrap-filestyle name on drop or paste This makes sure the upload form is visually updated when dropping or pasting a file. --- fbin/templates/upload.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'fbin/templates/upload.html') diff --git a/fbin/templates/upload.html b/fbin/templates/upload.html index 00f4de8..ccca30b 100644 --- a/fbin/templates/upload.html +++ b/fbin/templates/upload.html @@ -54,12 +54,14 @@ $(document).ready(function() { $('#dropzone').removeClass('drop-active drop-invalid'); if (event.originalEvent.dataTransfer.files.length == 1) { $(':file')[0].files = event.originalEvent.dataTransfer.files; + $('.bootstrap-filestyle input').val(event.originalEvent.dataTransfer.files[0].name); } }); $(document).on('paste', function(event) { var files = (event.clipboardData || event.originalEvent.clipboardData).files; if (files.length === 1) { $(':file')[0].files = files; + $('.bootstrap-filestyle input').val(files[0].name); } }); }); -- cgit v1.2.3