recently i followed some posts on stack overlflow about import some files in svelte, and this is the code:
<script>
let files = [];
function contentArray(ev){
files = [...files, ...ev.target.files.filter(f => !files.includes(f))]
}
</script>
<input type='file' multiple on:change={contentArray} accept=".txt">
{#each files as file}
<p>The imported file is: {file.name}</p>
{#await file.text() then text}
<pre>{text}</pre>
{/await}
{/each}
My goal is when I import a file, if I try to import it again, the program simply don't show it. I tried with the filter method but it gives me this error:
ev.target.files.filter is not a function or its return variable is not iterable
I searched a bit online, but i cannot understand where i made a mistake. Thanks in advance.