Compare commits
2 Commits
c2a149c872
...
ff875cc9d7
Author | SHA1 | Date | |
---|---|---|---|
ff875cc9d7 | |||
6d78d9ed64 |
@ -301,7 +301,15 @@ export const CreatePage = () => {
|
|||||||
|
|
||||||
const handleSelectFiles = (event: React.ChangeEvent<HTMLInputElement>) => {
|
const handleSelectFiles = (event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
if (event.target.files) {
|
if (event.target.files) {
|
||||||
setSelectedFiles(Array.from(event.target.files))
|
// Get the uploaded files
|
||||||
|
const files = Array.from(event.target.files)
|
||||||
|
|
||||||
|
// Remove duplicates based on the file.name
|
||||||
|
setSelectedFiles((p) =>
|
||||||
|
[...p, ...files].filter(
|
||||||
|
(file, i, array) => i === array.findIndex((t) => t.name === file.name)
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user