}
+// Delete an uploaded item from the list
+delete_upload = async(ref) => {
+
+ response = await fetch(
+ "/ctdl/p/" + ref, { method: "DELETE" }
+ );
+
+ if (response.ok) { // If the server accepted the delete, remove it from the screen
+ // FIXME do the delete
+ }
+}
+
+
function upload_file(file) {
var url = '/ctdl/p/';
var xhr = new XMLHttpRequest();
j_response.forEach((item) => {
let new_upl = document.createElement("li");
// item["ref"] is what we need
- new_upl.innerHTML = `<i class="fa-solid fa-circle-xmark" style="color:red" onClick="alert('` + item["ref"] + `')"></i>`
+ 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);