feat: add upload file list with progress (#1825)

This commit is contained in:
Filippo Finke
2022-02-21 19:30:42 +01:00
committed by GitHub
parent 6f226fa549
commit cf85404dd2
12 changed files with 325 additions and 147 deletions

View File

@@ -99,6 +99,15 @@ export function scanFiles(dt) {
});
}
function detectType(mimetype) {
if (mimetype.startsWith("video")) return "video";
if (mimetype.startsWith("audio")) return "audio";
if (mimetype.startsWith("image")) return "image";
if (mimetype.startsWith("pdf")) return "pdf";
if (mimetype.startsWith("text")) return "text";
return "blob";
}
export function handleFiles(files, base, overwrite = false) {
for (let i = 0; i < files.length; i++) {
let id = store.state.upload.id;
@@ -120,6 +129,7 @@ export function handleFiles(files, base, overwrite = false) {
path,
file,
overwrite,
type: detectType(file.type),
};
store.dispatch("upload/upload", item);