diff --git a/cards/templates/cards/_form.html b/cards/templates/cards/_form.html
index ef391f0..cb1fb16 100644
--- a/cards/templates/cards/_form.html
+++ b/cards/templates/cards/_form.html
@@ -114,6 +114,18 @@
if(!label) return;
if(fi.files.length === 0) label.textContent = 'No file chosen';
else label.textContent = fi.files.length > 1 ? fi.files.length + ' files selected' : fi.files[0].name;
+ // Prefill the name input from the filename if the name is empty
+ try {
+ const nameInput = formRoot.querySelector('input[name="name"]');
+ if(nameInput && (!nameInput.value || nameInput.value.trim() === '')){
+ const f = fi.files && fi.files[0];
+ if(f && f.name){
+ const base = f.name.replace(/\.[^/.]+$/, '');
+ const title = base.replace(/[_-]+/g, ' ').split(/\s+/).map(function(w){ return w.length? (w.charAt(0).toUpperCase() + w.slice(1)) : ''; }).join(' ').trim();
+ if(title) nameInput.value = title;
+ }
+ }
+ } catch(e){ /* ignore */ }
});
// Make sure clicking the visual label triggers the input if not already clickable
const outerLabel = fi.closest('.file').querySelector('.file-label');