mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 16:29:17 +08:00
fix: 解决拖动上传文件夹错误的问题 (#3983)
This commit is contained in:
parent
49dcb094dc
commit
96233ee9b2
@ -301,7 +301,7 @@ const submit = async () => {
|
|||||||
const chunk = file.raw.slice(start, end);
|
const chunk = file.raw.slice(start, end);
|
||||||
const formData = new FormData();
|
const formData = new FormData();
|
||||||
|
|
||||||
formData.append('filename', file.name);
|
formData.append('filename', getFilenameFromPath(file.name));
|
||||||
if (file.raw.webkitRelativePath != '') {
|
if (file.raw.webkitRelativePath != '') {
|
||||||
formData.append('path', path.value + '/' + getPathWithoutFilename(file.raw.webkitRelativePath));
|
formData.append('path', path.value + '/' + getPathWithoutFilename(file.raw.webkitRelativePath));
|
||||||
} else {
|
} else {
|
||||||
@ -350,6 +350,10 @@ const getPathWithoutFilename = (path: string) => {
|
|||||||
return path ? path.split('/').slice(0, -1).join('/') : path;
|
return path ? path.split('/').slice(0, -1).join('/') : path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getFilenameFromPath = (path) => {
|
||||||
|
return path ? path.split('/').pop() : path;
|
||||||
|
};
|
||||||
|
|
||||||
const acceptParams = (props: UploadFileProps) => {
|
const acceptParams = (props: UploadFileProps) => {
|
||||||
path.value = props.path;
|
path.value = props.path;
|
||||||
open.value = true;
|
open.value = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user