fixfilename

This commit is contained in:
scossa 2024-08-21 00:42:46 +02:00
parent ef1ba47787
commit f1be71efef
2 changed files with 4 additions and 2 deletions

View file

@ -121,7 +121,7 @@ textarea[name="description"] {
flex-wrap: nowrap; flex-wrap: nowrap;
align-items: flex-start; align-items: flex-start;
gap: 10px; gap: 10px;
margin: 20px 10px; margin: 23px 20px;
} }

View file

@ -1,8 +1,10 @@
document.getElementById('file-input').addEventListener('change', function() { document.getElementById('file-input').addEventListener('change', function() {
const fileName = this.files[0] ? this.files[0].name : 'No file chosen'; const fileName = this.files[0] ? this.files[0].name : 'No file chosen';
document.querySelector('.file-chosen').textContent = fileName; const truncatedFileName = fileName.length > 10 ? fileName.slice(0, 10) + '...' : fileName;
document.querySelector('.file-chosen').textContent = truncatedFileName;
}); });
export async function processForm (e) { export async function processForm (e) {
e.preventDefault(); e.preventDefault();
// const [name, description, image] = e.target[0,1,2] // const [name, description, image] = e.target[0,1,2]