mirror of
https://github.com/bewcloud/bewcloud.git
synced 2026-03-11 08:54:49 +00:00
Fix file upload via Web in Chrome and Firefox
Mentioned in #13 but unrelated to it.
This commit is contained in:
parent
e337859a22
commit
2a77915630
1 changed files with 15 additions and 6 deletions
|
|
@ -57,15 +57,17 @@ export default function MainFiles({ initialDirectories, initialFiles, initialPat
|
||||||
{ isOpen: boolean; isDirectory: boolean; path: string; name: string } | null
|
{ isOpen: boolean; isDirectory: boolean; path: string; name: string } | null
|
||||||
>(null);
|
>(null);
|
||||||
|
|
||||||
function onClickUploadFile() {
|
function onClickUploadFile(uploadDirectory = false) {
|
||||||
const fileInput = document.createElement('input');
|
const fileInput = document.createElement('input');
|
||||||
fileInput.type = 'file';
|
fileInput.type = 'file';
|
||||||
fileInput.multiple = true;
|
fileInput.multiple = true;
|
||||||
fileInput.webkitdirectory = true;
|
if (uploadDirectory) {
|
||||||
// @ts-expect-error - mozdirectory is not typed
|
fileInput.webkitdirectory = true;
|
||||||
fileInput.mozdirectory = true;
|
// @ts-expect-error - mozdirectory is not typed
|
||||||
// @ts-expect-error - directory is not typed
|
fileInput.mozdirectory = true;
|
||||||
fileInput.directory = true;
|
// @ts-expect-error - directory is not typed
|
||||||
|
fileInput.directory = true;
|
||||||
|
}
|
||||||
fileInput.click();
|
fileInput.click();
|
||||||
|
|
||||||
fileInput.onchange = async (event) => {
|
fileInput.onchange = async (event) => {
|
||||||
|
|
@ -577,6 +579,13 @@ export default function MainFiles({ initialDirectories, initialFiles, initialPat
|
||||||
>
|
>
|
||||||
Upload Files
|
Upload Files
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
class={`text-white block px-4 py-2 text-sm w-full text-left hover:bg-slate-600`}
|
||||||
|
onClick={() => onClickUploadFile(true)}
|
||||||
|
type='button'
|
||||||
|
>
|
||||||
|
Upload Directory
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
class={`text-white block px-4 py-2 text-sm w-full text-left hover:bg-slate-600`}
|
class={`text-white block px-4 py-2 text-sm w-full text-left hover:bg-slate-600`}
|
||||||
onClick={() => onClickCreateDirectory()}
|
onClick={() => onClickCreateDirectory()}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue