feat: 实现多部分上传功能,支持初始化、上传部分、完成和中止上传,添加媒体资产删除功能

This commit is contained in:
2026-01-04 15:20:06 +08:00
parent 2ab1238ef7
commit 2438d363f5
9 changed files with 454 additions and 21 deletions

View File

@@ -6,6 +6,8 @@ import (
"encoding/hex"
"fmt"
"net/url"
"os"
"path/filepath"
"strconv"
"time"
@@ -39,6 +41,19 @@ type Storage struct {
Config *Config
}
func (s *Storage) Delete(key string) error {
if s.Config.Type == "local" {
localPath := s.Config.LocalPath
if localPath == "" {
localPath = "./storage"
}
path := filepath.Join(localPath, key)
return os.Remove(path)
}
// TODO: S3 implementation
return nil
}
func (s *Storage) SignURL(method, key string, expires time.Duration) (string, error) {
exp := time.Now().Add(expires).Unix()
sign := s.signature(method, key, exp)