2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-06 20:03:13 +08:00

fix: file upload

This commit is contained in:
耗子
2023-07-24 18:19:13 +08:00
parent adbca77687
commit 5d7ae8d632
4 changed files with 5 additions and 13 deletions

View File

@@ -479,10 +479,6 @@ func (c *Mysql57Controller) UploadBackup(ctx http.Context) {
return
}
// TODO 框架 Bug ? 下面会 panic
controllers.Error(ctx, http.StatusBadRequest, "暂不支持")
return
file, err := ctx.Request().File("file")
if err != nil {
controllers.Error(ctx, http.StatusBadRequest, "上传文件失败")
@@ -495,8 +491,7 @@ func (c *Mysql57Controller) UploadBackup(ctx http.Context) {
}
name := file.GetClientOriginalName()
extension := file.GetClientOriginalExtension()
_, err = file.Store(backupPath + "/" + name + "." + extension)
_, err = file.StoreAs(backupPath, name)
if err != nil {
controllers.Error(ctx, http.StatusBadRequest, "上传文件失败")
return

View File

@@ -479,10 +479,6 @@ func (c *Mysql80Controller) UploadBackup(ctx http.Context) {
return
}
// TODO 框架 Bug ? 下面会 panic
controllers.Error(ctx, http.StatusBadRequest, "暂不支持")
return
file, err := ctx.Request().File("file")
if err != nil {
controllers.Error(ctx, http.StatusBadRequest, "上传文件失败")
@@ -495,8 +491,7 @@ func (c *Mysql80Controller) UploadBackup(ctx http.Context) {
}
name := file.GetClientOriginalName()
extension := file.GetClientOriginalExtension()
_, err = file.Store(backupPath + "/" + name + "." + extension)
_, err = file.StoreAs(backupPath, name)
if err != nil {
controllers.Error(ctx, http.StatusBadRequest, "上传文件失败")
return