diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index bf030601d5..1b70b9174c 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -956,9 +956,20 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac // Update link list & show file in upload widget.addEventListener("change", (e) => { + // Update lists document.querySelectorAll('et2-link-list').forEach(l => {l.get_links();}); - const info = e.target._dialog.fileInfo(e.target.value); - e.target.getParent().getWidgetById(attrs.id)?._addFile(info); + + // Show file(s) + const value = typeof e.target.value == "string" ? [e.target.value] : e.target.value; + value.forEach(v => + { + const info = e.target._dialog.fileInfo(v); + if(!e.target.multiple) + { + info.name = field.name; + } + e.target.getParent().getWidgetById(attrs.id)?._addFile(info); + }); e.target.getParent().getWidgetById(attrs.id).getDOMNode().classList.remove("hideme"); }); jQuery(widget.getDOMNode(widget)).css('vertical-align','top').prependTo(cf); diff --git a/api/src/Etemplate/Widget/Link.php b/api/src/Etemplate/Widget/Link.php index 85b3bb1f90..c303084718 100644 --- a/api/src/Etemplate/Widget/Link.php +++ b/api/src/Etemplate/Widget/Link.php @@ -314,7 +314,7 @@ class Link extends Etemplate\Widget } else { - if(!str_ends_with($dest_file, '/') && count($files) == 1 && is_int($id)) + if(!str_ends_with($dest_file, '/') && count($files) == 1) { // 1 file to a specific filename Api\Vfs::symlink($files[0], Api\Link::vfs_path($app, $id));