+// When an upload (or reupload) is complete, call this function to add it to the on-screen attachments list.
+function add_upload_to_displayed_list(item) {
+ let new_upl = document.createElement("li");
+ new_upl.setAttribute("id", item["ref"]); // set the element id to the upload reference
+ new_upl.innerHTML = `<i class="fa-solid fa-circle-xmark" style="color:red" onClick="delete_upload('` + item["ref"] + `')"></i>`
+ + ` `
+ + item["uploadfilename"] + " (" + item["contenttype"] + ", " + item["contentlength"] + " " + _("bytes") + ")";
+ document.getElementById("ctdl-upload_list").appendChild(new_upl);
+
+ // append it to the global list of uploads
+ uploads.push(item);
+ update_attachment_count();
+}
+
+