Support drag and drop for file upload

main
Charlotte Som 2023-07-06 22:58:33 +00:00
parent 87ed7066d7
commit 4dc268c11f
2 changed files with 30 additions and 1 deletions

View File

@ -36,6 +36,35 @@
document.querySelector(".file-upload-status").textContent = `no file selected.` document.querySelector(".file-upload-status").textContent = `no file selected.`
} }
}); });
document.addEventListener("dragover", event => {
fileInput.style['pointer-events'] = "auto";
});
document.addEventListener("drop", event => {
fileInput.style['pointer-events'] = "none";
});
document.addEventListener("dragleave", event => {
fileInput.style['pointer-events'] = "none";
});
</script> </script>
<style>
input[type=file] {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
overflow: hidden;
padding: 0;
margin: 0;
pointer-events: none;
opacity: 0;
border: none;
display: block;
}
</style>
{% endblock %} {% endblock %}
{% endblock %} {% endblock %}

View File

@ -1,3 +1,3 @@
#!/usr/bin/env sh #!/usr/bin/env sh
gunicorn --threads 16 -b '127.0.0.2:8000' demucs_server:app gunicorn --threads 16 --timeout 5 -b '127.0.0.2:8000' demucs_server:app