File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
src/resources/views/crud/fields Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ function bpFieldInitUploadMultipleElement(element) {
219219
220220 fileInput .change (function () {
221221 let selectedFiles = [];
222+ let existingFiles = fileInput .parent ().siblings (' .existing-file' );
222223
223224 Array .from ($ (this )[0 ].files ).forEach (file => {
224225 selectedFiles .push ({name: file .name , type: file .type })
@@ -231,11 +232,11 @@ function bpFieldInitUploadMultipleElement(element) {
231232 selectedFiles .forEach (file => {
232233 files += ' <span class="badge mt-1 mb-1 text-bg-secondary badge-primary">' + file .name + ' </span> ' ;
233234 });
234-
235+
235236 // if existing files is not on the page, create a new div a prepend it to the fileInput
236237 if (existingFiles .length === 0 ) {
237238 existingFiles = $ (' <div class="well well-sm existing-file mb-2"></div>' );
238- existingFiles .insertBefore (element .find (' input[type=hidden]' ));
239+ existingFiles .insertBefore (element .find (' input[type=hidden]' ). first () );
239240 existingFiles .html (files);
240241 }else {
241242 // if existing files is on page show the added files after the uploaded ones
You can’t perform that action at this time.
0 commit comments