1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

feat: 文件上传优化 (#1607)

This commit is contained in:
zhengkunwang223 2023-07-11 18:19:20 +08:00 committed by GitHub
parent 66b12800e4
commit 919f10cc11
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 5 deletions

View File

@ -683,7 +683,12 @@ func (b *BaseApi) UploadChunkFiles(c *gin.Context) {
}
filename := c.PostForm("filename")
fileDir := filepath.Join(tmpDir, filename)
_ = os.MkdirAll(fileDir, 0755)
if chunkIndex == 0 {
if fileOp.Stat(fileDir) {
_ = fileOp.DeleteDir(fileDir)
}
_ = os.MkdirAll(fileDir, 0755)
}
filePath := filepath.Join(fileDir, filename)
defer func() {

View File

@ -846,8 +846,8 @@ const message = {
containSub: '同時修改子文件屬性',
ownerHelper: 'PHP 運行環境默認用戶:用戶組為 1000:1000, 容器內外用戶顯示不一致為正常現象',
searchHelper: '支持 * 等通配符',
uploadFailed: '[{0}] 文件上傳失敗',
fileUploadStart: '正在上傳[{0}]....',
uploadFailed: '{0} 文件上傳失敗',
fileUploadStart: '正在上傳{0}....',
currentSelect: '當前選中: ',
},
ssh: {

View File

@ -846,8 +846,8 @@ const message = {
containSub: '同时修改子文件属性',
ownerHelper: 'PHP 运行环境默认用户:用户组为 1000:1000, 容器内外用户显示不一致为正常现象',
searchHelper: '支持 * 等通配符',
uploadFailed: '[{0}] 文件上传失败',
fileUploadStart: '正在上传[{0}]....',
uploadFailed: '{0} 文件上传失败',
fileUploadStart: '正在上传{0}....',
currentSelect: '当前选中: ',
},
ssh: {

View File

@ -124,6 +124,7 @@ const submit = async () => {
);
uploadPrecent.value = progress;
},
timeout: 40000,
});
uploadedChunkCount++;
} catch (error) {