|
|
|
|
@ -9,6 +9,7 @@
@@ -9,6 +9,7 @@
|
|
|
|
|
const router = useTinyRouter(); |
|
|
|
|
let children = $state({}); |
|
|
|
|
let new_dir = $state(null); |
|
|
|
|
let files = $state(); |
|
|
|
|
let parent = $state(false); |
|
|
|
|
let form = $state(false); |
|
|
|
|
let path = $state(null) |
|
|
|
|
@ -95,6 +96,26 @@
@@ -95,6 +96,26 @@
|
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async function upload_file(ev){ |
|
|
|
|
ev.preventDefault(); |
|
|
|
|
console.log(files); |
|
|
|
|
const dataArray = new FormData(); |
|
|
|
|
dataArray.append("uploadFile", files); |
|
|
|
|
const url = api('files'+path); |
|
|
|
|
const resp = fetch(url, { |
|
|
|
|
credentials: 'include', |
|
|
|
|
method: 'POST', |
|
|
|
|
headers: [["Content-Type", "multipart/form-data"]], |
|
|
|
|
body: dataArray |
|
|
|
|
}); |
|
|
|
|
if (resp.ok){ |
|
|
|
|
yikes(); |
|
|
|
|
} else { |
|
|
|
|
error(resp); |
|
|
|
|
} |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
onMount(() => loadChildren(window.location.pathname)); |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
@ -134,10 +155,10 @@ parent: {parent}
@@ -134,10 +155,10 @@ parent: {parent}
|
|
|
|
|
{/if} |
|
|
|
|
{#if form} |
|
|
|
|
<li class="action"> |
|
|
|
|
<form> |
|
|
|
|
<form onsubmit={upload_file}> |
|
|
|
|
<span class="symbol">+</span> |
|
|
|
|
<input type="file" /> |
|
|
|
|
<button>{t('upload_file')}</button> |
|
|
|
|
<input type="file" bind:files /> |
|
|
|
|
<button disabled={!files}>{t('upload_file')}</button> |
|
|
|
|
</form> |
|
|
|
|
</li> |
|
|
|
|
{/if} |
|
|
|
|
|