Remove old file uploader

This commit is contained in:
2023-05-29 18:01:23 +02:00
parent 34bd15fa8b
commit 20730141d5
6 changed files with 23 additions and 263 deletions

View File

@@ -39,6 +39,8 @@ export const upload_file = async (file, bucket, path, on_progress, on_success, o
return
}
console.log("Uploading file to ", fs_path_url(bucket, path))
let xhr = new XMLHttpRequest();
xhr.open("PUT", fs_path_url(bucket, path), true);
xhr.timeout = 86400000; // 24 hours, to account for slow connections

View File

@@ -24,11 +24,10 @@ let visible = false
let upload_queue = [];
let task_id_counter = 0
export const upload_files = async (files) => {
export const upload_files = async files => {
if (files.length === 0) {
return
}
if (current_dir.type !== "dir") {
}else if (fs_state.base.type !== "dir") {
alert("Can only upload to directory")
return
}
@@ -43,16 +42,22 @@ export const upload_file = async file => {
if (fs_state.base.type !== "dir") {
alert("Can only upload to directory")
return
}
if (file.type === "" && file.size === 0) {
}else if (file.type === "" && file.size === 0) {
return
}
let path = fs_state.base.path + "/"
if (file.webkitRelativePath) {
path += file.webkitRelativePath
} else {
path += file.name
}
upload_queue.push({
task_id: task_id_counter,
file: file,
bucket: fs_state.root.id,
path: fs_state.base.path + "/" + file.webkitRelativePath,
path: path,
component: null,
status: "queued",
total_size: file.size,