🎨优化文件上传机制
This commit is contained in:
parent
2c1450990b
commit
697341f823
@ -29,7 +29,7 @@ func (fileSystem) UploadFile(file []byte, suffix string) (filePath string, err e
|
||||
return "", err
|
||||
}
|
||||
|
||||
return ossObj.LongPath, nil
|
||||
filePath = ossObj.LongPath
|
||||
case "local":
|
||||
filePath = fmt.Sprintf("%v/%d-avatar%s", config.Config.File.Path, time.Now().Unix(), suffix)
|
||||
// 创建目录
|
||||
@ -40,8 +40,6 @@ func (fileSystem) UploadFile(file []byte, suffix string) (filePath string, err e
|
||||
if err = os.WriteFile(filePath, file, os.FileMode(0777)); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return filePath, nil
|
||||
}
|
||||
return "", nil
|
||||
return filePath, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user